Why is this command crashing pawno? - 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: Why is this command crashing pawno? (
/showthread.php?tid=611218)
Why is this command crashing pawno? -
MayaEU - 03.07.2016
Why does pawno crash when im trying to compile this command?
pawn Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
if(!PlayerInfo[playerid][pAdmin])
{
if(PlayerInfo[playerid][pNewbieBanned])
return SendClientMessage(playerid, COLOR_GRAD2, " You are banned from using the newbie chat.");
}
strmid(tmp,cmdtext,idx,strlen(cmdtext));
if(stringContainsIP(tmp))
return SendClientMessage(playerid, COLOR_RED, "you cant adversite ip's here!");
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" (/n)ewbie [newbie chat]");
switch(NewbieHelper[playerid])
{
case 1: format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
case 2: {
if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Moderator %s:%s **",RemoveUnderScore(playerid),tmp);
}
case 3: {
if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Admin %s:%s **",RemoveUnderScore(playerid),tmp);
}
default: if(PlayerInfo[playerid][pLevel] >= 3 && !NewbieHelper[playerid])
format(string, sizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Newbie %s:%s **",RemoveUnderScore(playerid),tmp);
}
}
}
}
SendClientMessageToAll(COLOR_LIGHTGREEN,string);
return 1;
}
Re: Why is this command crashing pawno? -
FuNkYTheGreat - 03.07.2016
You were opening 5 and closing 8 Try this;
Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
if(!PlayerInfo[playerid][pAdmin])
{
if(PlayerInfo[playerid][pNewbieBanned])
return SendClientMessage(playerid, COLOR_GRAD2, " You are banned from using the newbie chat.");
}
strmid(tmp,cmdtext,idx,strlen(cmdtext));
if(stringContainsIP(tmp))
return SendClientMessage(playerid, COLOR_RED, "you cant adversite ip's here!");
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" (/n)ewbie [newbie chat]");
switch(NewbieHelper[playerid])
{
case 1: format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
case 2: {
if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Moderator %s:%s **",RemoveUnderScore(playerid),tmp);
}
case 3: {
if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Admin %s:%s **",RemoveUnderScore(playerid),tmp);
}
default: if(PlayerInfo[playerid][pLevel] >= 3 && !NewbieHelper[playerid])
format(string, sizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
else
format(string, sizeof(string), "** Newbie %s:%s **",RemoveUnderScore(playerid),tmp);
}
SendClientMessageToAll(COLOR_LIGHTGREEN,string);
return 1;
}