Admin system - 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: Admin system (
/showthread.php?tid=299593)
Admin system -
Kakioshe22 - 26.11.2011
PHP код:
C(adgoto)
{
new giveid, id, name2[MAX_PLAYER_NAME];
if(PData[playerid][Level] < 1) return SCM(playerid, red, "Unknown Command, Use /cmds To See All Valid Commands.");
else if(sscanf(params, "r", giveid)) return SCM(playerid, ADMIN, "USAGE: /adgoto <Name/Id>");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red, " This Player Is Not Connected.");
else
{
GetPlayerName(giveid, name2, sizeof(name2));
new Float:x, Float:y, Float:z;
GetPlayerPos(giveid, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
format(str2, sizeof(str2), "You Have Teleported To %s.", name2);
SCM(playerid, ADMIN, str2);
}
return 1;
}
SCM = SendClientMessage
PHP код:
#define SCM SendClientMessage
This cmd works and all, but when player id is 3> you cant go to him it says "This Player Is Not Connected"
please help
Re: Admin system -
Da' J' - 26.11.2011
Nvm.
Re: Admin system -
SmiT - 26.11.2011
You passed the variable "giveid" with sscanf but you check if variable "id" is connected.
pawn Код:
else if ( !IsPlayerConnected( giveid ) )
Re: Admin system -
MP2 - 26.11.2011
@Da' J': Don't post if you don't know what you're talking about, because it's not helpful.
pawn Код:
C(adgoto)
{
new id, name2[MAX_PLAYER_NAME];
if(PData[playerid][Level] < 1) return SCM(playerid, red, "Unknown Command, Use /cmds To See All Valid Commands.");
if(sscanf(params, "r", id)) return SCM(playerid, ADMIN, "USAGE: /adgoto <Name/Id>");
if(!IsPlayerConnected(id)) return SCM(playerid, red, " This Player Is Not Connected.");
GetPlayerName(id, name2, sizeof(name2));
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
format(str2, sizeof(str2), "You Have Teleported To %s.", name2);
SCM(playerid, ADMIN, str2);
return 1;
}
Re: Admin system -
Wesley221 - 26.11.2011
Try using the 'u' or 'i/d' instead of the 'r' specifier.
Not sure if that would cause the problem.