04.10.2013, 18:31
It's because you never specified DrunkLevel to take the value of a parameter.
So DrunkLevel was always 0.
EDIT: I fixed the command up a bit more. People with admin level of 2+ will not be able to use it. I made it so people with admin level of 0 will not be able to use it. Also;
Should be before:
EDIT2: Also, you were storing the 'PlayerId/PartOfName' passed as a parameter into 'playerid' instead of 'giveplayerid'.
So DrunkLevel was always 0.
pawn Код:
CMD:drunk(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1 ) return 0;
if( GetPlayerVirtualWorld( playerid ) != 0 ) return SendClientMessage( playerid, COLOR_RED, "[ ! ] You can't use Admin Commands in Virtual World !" );
new giveplayerid,DrunkLevel;
if(sscanf(params,"ui",giveplayerid,DrunkLevel)) return SendClientMessage(playerid, COLOR_RED1, "[ ! ] USAGE: /drunk <playerid> <drunklevel>");
if( DrunkLevel < 2000 || DrunkLevel > 50000 ) return SendClientMessage( playerid, COLOR_RED, "[ ! ] Invalid Drunk Level (2000-50000)." );
SetPlayerDrunkLevel(giveplayerid, DrunkLevel);
SendClientMessage(giveplayerid, COLOR_RED1, "[ ! ] Your Drunk Level has been set to %d by an Admin");
return 1;
}
pawn Код:
if( DrunkLevel < 2000 || DrunkLevel > 50000 ) return SendClientMessage( playerid, COLOR_RED, "[ ! ] Invalid Drunk Level (2000-50000)." );
pawn Код:
SetPlayerDrunkLevel(giveplayerid, DrunkLevel);
EDIT2: Also, you were storing the 'PlayerId/PartOfName' passed as a parameter into 'playerid' instead of 'giveplayerid'.