Need help with goto Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with goto Command (
/showthread.php?tid=277362)
Need help with goto Command -
mrsamp - 17.08.2011
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!
Re: Need help with goto Command -
[OC]Zero - 17.08.2011
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;
}
Re: Need help with goto Command -
mrsamp - 17.08.2011
Thank you man! It works! And Thank You for fast reply

!
EDIT: lol i what a little "fail" :P but thanks anyway LOL
Re: Need help with goto Command -
[OC]Zero - 17.08.2011
Your welcome.
Re: Need help with goto Command -
mrsamp - 18.08.2011
lol but it doesnt work... it dont teleport to player only to yourself...
Re: Need help with goto Command -
Wesley221 - 18.08.2011
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
Re: Need help with goto Command -
mrsamp - 18.08.2011
Thanks!