CMD:osetadmin(playerid, params[]) { if(IsPlayerAdmin(playerid)) { new string[128], name[MAX_PLAYER_NAME]; if(sscanf(params, "si", name, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /osetadmin [playername] [time (minutes)] [reason]"); new giveplayerid = ReturnUser(name); if(IsPlayerConnected(giveplayerid)) { SendClientMessage(playerid, COLOR_GRAD2, "That player is online, use /setadmin for online players."); return 1; } if(PlayerInfo[MAX_PLAYERS][pAdmin] == 6) return SendClientMessage(playerid, COLOR_GRAD1, "You cant offline setadmin an Level 6 Admin"); else if(doesAccountExist(name)) { OnPlayerOfflineLogin(name); if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1) { SendClientMessage(playerid, COLOR_WHITE, "That player is banned."); return 1; } else { format(string, sizeof(string), "AdmCmd: %s was offline setadmin to %d by %s", name, GetPlayerNameEx(playerid), params); ABroadCast(COLOR_LIGHTRED,string,1); PlayerInfo[name][pAdmin] = params; OnPlayerOfflineSave(name); } } else { SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist."); } } return 1; }
format(PlayerInfo[name][pAdmin], sizeof(params),params);
C:\Users\ASD\Desktop\0.3z Server\ASD\gamemodes\ASDASD(24589) : error 033: array must be indexed (variable "name") C:\Users\ASD\Desktop\0.3z Server\ASD\gamemodes\ASDASDn(24589) : warning 224: indeterminate array size in "sizeof" expression (symbol "") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
CMD:osetadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new string[128], name[MAX_PLAYER_NAME],lvl;
if(sscanf(params, "ui", name,lvl)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /osetadmin [Playername] [Admin Level]");
new giveplayerid = ReturnUser(name);
if(IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_GRAD2, "That player is online, use /setadmin for online players.");
return 1;
}
if(PlayerInfo[MAX_PLAYERS][pAdmin] == 6) return SendClientMessage(playerid, COLOR_GRAD1, "You cant offline setadmin an Level 6 Admin");
else if(doesAccountExist(name))
{
OnPlayerOfflineLogin(name);
if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE, "That player is banned.");
return 1;
}
else
{
format(string, sizeof(string), "AdmCmd: %s was offline setadmin to %d by %s.", name,lvl,GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,1);
PlayerInfo[name][pAdmin] = lvl;
OnPlayerOfflineSave(name);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
}
}
return 1;
}
use this sscanf line
sscanf(params, "ui", name, params) use the "u" in it because string variable cannot be used in EDIT: change name to a int value remove [] thing from its front while declaration |