23.04.2010, 14:33
My command (DCMD) setdonator doesn't work correctly because when I type /setdonator (no player ID or donatorlvl) it says ''Administrator [UF]DarkPhoenix has set your donator level to 0''. But, I don't get the lvl 0 part because I didn't fill in a donator level or even player ID. It's supposed to be /setdonator [playername/id] [donator level (1-3)]
Here's my command (DCMD):
Here's my command (DCMD):
pawn Код:
dcmd_setdonator(playerid, params[])
{
new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
if(sscanf(params,"ud"),target,donatorlvl) SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");
GetPlayerName(playerid, adminName, sizeof(adminName));
format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
SystemMsg(target, myString),
GetPlayerName(target, targetName, sizeof(targetName));
format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);
pInfo[playerid][pDonator] = donatorlvl;
dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
return 1;
}