enum pInfo
{
pPass,
pCash,
pAdminLevel,
pVIPLevel,
pScores,
pIP[24],
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
CMD:setadminlevel (playerid, params[])
{
if(PlayerInfo[ playerid ][ pAdminLevel ] < 9 && !IsPlayerAdmin( playerid ) ) return SendClientMessage(playerid, -1,"You must be a higher level admin to use this command");
new level, aname[MAX_PLAYER_NAME];
new targetid;
if(sscanf(params, "ri", targetid, level)) return SendClientMessage(playerid, -1,"ERROR: /setadminlevel playerid level");
if (level > 10 || level < 0) return SendClientMessage(playerid, -1,"ERROR: invalid level");
if(!IsPlayerConnected( targetid )) return SendClientMessage(playerid, -1,"ERROR: player isn't connected");
new string1[130], tname[MAX_PLAYER_NAME], string2[130];
//if(!fexist(UserPath( targetid )))return SendClientMessage(playerid, -1,"ERROR: player isn't registered");
/*
new INI:File = INI_Open(UserPath( targetid ));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level", level);
INI_Close(File);
*/
PlayerInfo[ targetid ][ pAdminLevel ] = level;
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(targetid, tname, sizeof(tname));
format(string1, sizeof(string1), "Admin %s has set your Admin level to %i ", aname, level);
SendClientMessage(targetid, Green, string1);
format(string2, sizeof(string1), "Admin %s has set %s's level to %i", aname, tname, level);
SendClientMessageToAll(Yellow, string2);
return 1;
}
//if(!fexist(UserPath( targetid )))return SendClientMessage(playerid, -1,"ERROR: player isn't registered");
/*
new INI:File = INI_Open(UserPath( targetid ));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level", level);
INI_Close(File);
*/
pawn Код:
|
CMD:stats(playerid,o[])
{
new string[500] , pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
new Float:ratio[MAX_PLAYERS]=PlayerInfo[playerid][pKills]/PlayerInfo[playerid][pDeaths];
format(string,sizeof(string),"-----------------STATS-----------------");
SendClientMessage(playerid, YELLOW,string);
format(string,sizeof(string),"* Stats Of %s *",pName);
SendClientMessage(playerid, BLUE,string);
format(string,sizeof(string),"Password: %s | Cash: %d | Deaths: %d | Kills: %d | Ratio: %d | Score: %d | Admin: %d |",pPass,pCash,pDeaths,pKills,ratio,pScores,pAdminLevel);
SendClientMessage(playerid,BLUE,string);
format(string,sizeof(string),"-----------------STATS-----------------");
SendClientMessage(playerid,YELLOW,string);
return 1;
}
error 008: must be a constant expression; assumed zero |
CMD:setlevel(playerid,params[])
{
new target,level,string[124],PlayerName[24];
if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"USAGE:/setlevel [playerid] [level]");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"ERROR:Invalid level. (1,2,3)");
GetPlayerName(target,PlayerName,sizeof(PlayerName));
format(string,sizeof(string),"%s has been made a level %d admin!",PlayerName,level);
SendClientMessageToAll(-1,string);
pInfo[playerid][pAdminLevel] = level;
return 1;
}
CMD:setviplevel(playerid,params[])
{
new target,level,string[124],PlayerName[24];
if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"USAGE:/seviplevel [playerid][level]");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
if(level < 0 || level > 1) return SendClientMessage(playerid,-1,"ERROR:Invalid level.(1 one only)");
GetPlayerName(target,PlayerName,sizeof(PlayerName));
format(string,sizeof(string),"%s has been made a level %d VIP",PlayerName,level);
pInfo[playerid][pVIPLevel] = level;
return 1;
}