Whats rong with this? - 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: Whats rong with this? (
/showthread.php?tid=137920)
Whats rong with this? -
-Rebel Son- - 30.03.2010
ok, so, i got my system to save my account level, but now... i need a kick command, i got this one, but ingame, im level 4, and i think it needs level 1.
and it says i dont got the permission to use it. Any ideas?
Код:
if(strcmp(cmd,"/kick",true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][Level] = dini_Int(file, "level");
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_BLUE, "Correct Usage: /kick [id] [reason]");
return 1;
}
giveplayerid = strval(tmp);
giveplayerid = strval(tmp);
if(IsLogged[playerid] == 1)
{
if(PlayerInfo[playerid][Level] == 1)
{
if(IsPlayerConnected(giveplayerid))
{
if( WarnedTimes[giveplayerid] == 0 && PlayerInfo[playerid][Level] == 2)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: The player hasnt been Warned !");
} else {
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
result = "No reason";
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "***AdmCMD: %s was KICKED by admin %s for: %s", giveplayer, sendername, result);
SendClientMessageToAll(COLOR_BLUE, string);
Kick(giveplayerid);
new PlayerName[30];
GetPlayerName(playerid, PlayerName, 30);
printf("[Command] %s has used /kick to kick %s for: %s", PlayerName, giveplayer, result);
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
}
return 1;
}
Re: Whats rong with this? -
Carlton - 30.03.2010
The operators needs to be changed.
if(PlayerInfo[playerid][Level] == 1)
{
needs to be changed to:
if(PlayerInfo[playerid][Level] >= 1)
{
Re: Whats rong with this? -
-Rebel Son- - 30.03.2010
oh thanks.