SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 17/08/2011, 04:32 PM   #1
mrsamp
Big Clucker
 
mrsamp's Avatar
 
Join Date: Jul 2010
Posts: 126
Reputation: 9
Question Need help with goto Command

Can some1 plzz hel me with the "/goto" command i got this:
Code:
command(goto, playerid, params[])
{
    new ID;
    new vehicleid;
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [id]");
    else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
    else if(IsPlayerInVehicle(playerid, vehicleid))
    {
    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);
    SetVehiclePos(vehicleid, x+1, y+1, z);
    }
    else
    {
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	SetPlayerPos(playerid, x+1, y+1, z);
	}
	return 1;
}
its working but when im in vehicle only player "teleport" can someone help me to get the vehicle to "teleport" if player is in vehicle.. Thank you! BTW!: no error's/warning's!
__________________
Now 24/7
mrsamp is offline  
Old 17/08/2011, 04:36 PM   #2
[OC]Zero
Little Clucker
 
[OC]Zero's Avatar
 
Join Date: Apr 2011
Location: Do you Need To know.
Posts: 24
Reputation: 0
Default Re: Need help with goto Command

Try This
pawn Code:
command(goto, playerid, params[])
{
    new ID;
    new vehicleid = GetPlayerVehicleID(playerid);
    if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_RED, "USAGE: /goto [id]");
    else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
    else if(IsPlayerInVehicle(playerid, vehicleid))
    {
    new Float:x, Float:y, Float:z;
    GetVehiclePos(vehicleid, x, y, z);
    SetVehiclePos(vehicleid, x+1, y+1, z);
    }
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    }
    return 1;
}
__________________
Dubstep
[OC]Zero is offline  
Old 17/08/2011, 04:41 PM   #3
mrsamp
Big Clucker
 
mrsamp's Avatar
 
Join Date: Jul 2010
Posts: 126
Reputation: 9
Default Re: Need help with goto Command

Thank you man! It works! And Thank You for fast reply !
EDIT: lol i what a little "fail" :P but thanks anyway LOL
__________________
Now 24/7

Last edited by mrsamp; 17/08/2011 at 04:42 PM. Reason: FAIL
mrsamp is offline  
Old 17/08/2011, 04:43 PM   #4
[OC]Zero
Little Clucker
 
[OC]Zero's Avatar
 
Join Date: Apr 2011
Location: Do you Need To know.
Posts: 24
Reputation: 0
Default Re: Need help with goto Command

Your welcome.
__________________
Dubstep
[OC]Zero is offline  
Old 18/08/2011, 02:19 PM   #5
mrsamp
Big Clucker
 
mrsamp's Avatar
 
Join Date: Jul 2010
Posts: 126
Reputation: 9
Default Re: Need help with goto Command

lol but it doesnt work... it dont teleport to player only to yourself...
__________________
Now 24/7
mrsamp is offline  
Old 18/08/2011, 02:45 PM   #6
Wesley221
High-roller
 
Wesley221's Avatar
 
Join Date: Apr 2011
Posts: 1,904
Reputation: 674
Default Re: Need help with goto Command

pawn Code:
COMMAND:goto(playerid, params[])
{
    new Target;
    if(!sscanf(params, "i", Target))
    {
        if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected!");
        if(IsPlayerInAnyVehicle(playerid))
        {
            new Float:pos[3];
            GetVehiclePos(GetPlayerVehicleID(Target), pos[0], pos[1], pos[2]);
            SetVehiclePos(GetPlayerVehicleID(playerid), pos[0], pos[1], pos[2]);
        } else {
            new Float:pos[3];
            GetPlayerPos(Target, pos[0], pos[1], pos[2]);
            SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        }
    } else return SendClientMessage(playerid, -1, "Usage: /goto [playerid]");
    return 1;
}
Try this one
__________________
yes
Wesley221 is offline  
Old 18/08/2011, 02:47 PM   #7
mrsamp
Big Clucker
 
mrsamp's Avatar
 
Join Date: Jul 2010
Posts: 126
Reputation: 9
Default Re: Need help with goto Command

Thanks!
__________________
Now 24/7
mrsamp is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need some help with a goto command and gethere Shockey HD Help Archive 6 19/07/2011 07:29 AM
Need Command Goto (ZCMD) SamyRomafia Help Archive 5 01/01/2011 08:42 PM
Problem with /goto command sobolanux Help Archive 0 10/04/2010 01:35 PM
How to make a /gethere «id» and /goto «id» command? Rubennnnn Help Archive 12 02/12/2009 06:42 AM
/getgun & /armour & /goto command WanabePC Help Archive 3 22/04/2009 06:49 PM


All times are GMT. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.