String error - 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: String error (
/showthread.php?tid=310075)
String error -
[LHT]Bally - 10.01.2012
whats wrong with this ?
pawn Код:
CMD:slap(playerid, params[])
{
SendAdminText(playerid, "/slap", params);
{
new ID;
if(APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, -1, "you are not admin.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "Use: /slap [ID]");
new Float:Pos[3];
GetPlayerPos(ID, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(ID, Pos[0], Pos[1], Pos[2]+10);
SendClientMessage(playerid, 0xff0000FF, "You have been slapped By Admin %s", Name);
format(string, 128, "{808080}%s %s has Slapped {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
SendClientMessageToAll(0xFFFFFFFF, string);
}
return 1;
}
errors
pawn Код:
C:\Documents and Settings\BaLLy\Desktop\The Original\pawno\include\PPC_PlayerCommands.inc(12) : error 017: undefined symbol "Name"
C:\Documents and Settings\BaLLy\Desktop\The Original\pawno\include\PPC_PlayerCommands.inc(13) : error 017: undefined symbol "string"
C:\Documents and Settings\BaLLy\Desktop\The Original\pawno\include\PPC_PlayerCommands.inc(14) : warning 217: loose indentation
C:\Documents and Settings\BaLLy\Desktop\The Original\pawno\include\PPC_PlayerCommands.inc(14) : error 017: undefined symbol "string"
Re: String error -
THE_KNOWN - 10.01.2012
pawn Код:
CMD:slap(playerid, params[])
{
SendAdminText(playerid, "/slap", params);
{
new ID,string[128],Name[24];
if(APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, -1, "you are not admin.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "Use: /slap [ID]");
new Float:Pos[3];
GetPlayerPos(ID, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(ID, Pos[0], Pos[1], Pos[2]+10);
SendClientMessage(playerid, 0xff0000FF, "You have been slapped By Admin %s", Name);
format(string, 128, "{808080}%s %s has Slapped {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
SendClientMessageToAll(0xFFFFFFFF, string);
}
return 1;
}
Re: String error -
Konstantinos - 10.01.2012
pawn Код:
CMD:slap(playerid, params[])
{
SendAdminText(playerid, "/slap", params);
new ID, string[128], Name[MAX_PLAYER_NAME];
if(APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, -1, "you are not admin.");
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "Use: /slap [ID]");
new Float:Pos[3];
GetPlayerPos(ID, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(ID, Pos[0], Pos[1], Pos[2]+10);
SendClientMessage(playerid, 0xff0000FF, "You have been slapped By Admin %s", Name);
format(string, 128, "{808080}%s %s has Slapped {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
return SendClientMessageToAll(0xFFFFFFFF, string);
}
By the way, why you opened a bracket after SendAdminText. It doesn't need.