setlevel command problem - 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: setlevel command problem (
/showthread.php?tid=478682)
setlevel command problem -
Audi_Quattrix - 30.11.2013
My code:
Код:
CMD:setlevel(playerid, params[])
{
new giveid, level;
PlayerInfo[giveid][pAdmin] = level;
if(PlayerInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid));
{
SendClientMessage(playerid, COL_RED, "ERROR: You don't have access to this command.");
}
else if(sscanf(params, "ri", giveid, level));
{
SendClientMessage(playerid, COL_RED, "SYNTAX: /setlevel <name/id> <level>");
}
else if(!PlayerInfo[playerid][LoggedIn] == 1 || giveid == INVALID_PLAYER_ID);
{
SendClientMessage(playerid, COL_RED, "ERROR: That player isn't online or isn't logged in!");
}
else if(level > 5 || level < 0);
{
SendClientMessage(playerid, COL_RED, "ERROR: The level must be between 0 and 5.");
}
else
{
new name[24],level[128],level1[128],pname[24];
GetPlayerName(giveid, name, sizeof(name));
GetPlayerName(playerid, pname, sizeof(pname));
format(str,sizeof(str),"You have been set to level %d by %s!",level,name);
SendClientMessage(giveid,COL_GREEN,level);
format(level1,sizeof(level1),"You have successfully set %s to level %d!",pname,level);
SendClientMessage(playerid,COL_GREEN,level1);
}
return 1;
}
My errors:
Код:
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(367) : error 036: empty statement
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(369) : error 035: argument type mismatch (argument 2)
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(371) : error 029: invalid expression, assumed zero
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(371) : warning 215: expression has no effect
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(371) : error 001: expected token: ";", but found "if"
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(371) : error 036: empty statement
C:\Users\Lauris.Lauris-PC\Desktop\Samp\samp03x_svr_R2_win32\Admin.pwn(371) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
Re: setlevel command problem -
Mitchy - 30.11.2013
Try this(untested.):
pawn Код:
CMD:setlevel(playerid, params[])
{
new giveid, level;
if(sscanf(params, "uii", giveid, level)) return SendClientMessage(playerid, COL_RED, "SYNTAX: /setlevel <name/id> <level>");
{
if(level < 5 || level > 0)
{
new name[24], level[128], level1[128],pname[24];
GetPlayerName(giveid, name, sizeof(name));
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "You have been set to level %d by %s", level, name);
PlayerInfo[giveid][pAdmin] = level;
SendClientMessage(giveid, COL_GREEN, level);
format(level, sizeof(level1), "You have successfully set %s to level %d", pname, level);
SendClientMessage(playerid, COL_GREEN, level1);
}
else return SendClientMessage(playerid, COL_RED, "Levels are between level 1 through 5!");
}
}