SA-MP Forums Archive
Goto help - 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)
+--- Thread: Goto help (/showthread.php?tid=534358)



Goto help - Gogeta101 - 29.08.2014

PHP код:
CMD:goto(playerid,params[])
{
new 
targetid;
if(
sscanf(params,"u",targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]/goto [playerid]");
if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]player not connected");
if(
playerid == targetid) return SendClientMessage(playerid,GetPlayerColor(playerid),"You Can't teleport to yourself");
new 
Float:x,Float:y,Float:z;
GetPlayerPos(targetid,x,y,z);
SetPlayerPos(playerid,x,y,z);

error 017: undefined symbol "sscanf"

Errors


Re: Goto help - Phyzic - 29.08.2014

use include sscanf.


Re: Goto help - PMH - 29.08.2014

#include <sscanf> on top of ur script


Re: Goto help - EPIC2LA - 29.08.2014

Or try :


CMD:goto(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /goto [playerid]");

new Floatlocx,Floatlocy,Floatlocz;
if (IsPlayerConnected(giveplayerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
return 1;
}
GetPlayerPos(giveplayerid, plocx, plocy, plocz);
SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
Streamer_UpdateEx(playerid, plocx, plocy, plocz);

if (GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
}
else
{
SetPlayerPos(playerid,plocx,plocy+2, plocz);
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
}

SendClientMessageEx(playerid, COLOR_GRAD1, " You have been teleported!");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}

}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}