13.08.2009, 19:19
Hey i got a problem with my dudb..I dont know how to use the dcmd_setadmin ==> about how to save the players level and I need a hand here
enumaration..
// dcmd
// on disconnect
enumaration..
Код:
enum PlayerInfo { Level, Banned, Muted }; new PlayerData[MAX_PLAYERS][PlayerInfo];
Код:
dcmd_setadmin(playerid,params[]) { if(PlayerData[playerid][Level] == 3) { new tmp[256],idx; tmp = strtok(params,idx); if(!strlen(tmp)) { return SystemMsg(playerid,"Usage: /setadmin <playerid> <level 1-3>"); } new id = strval(tmp); if(!IsPlayerConnected(id)) { return SystemMsg(playerid,"Incorrect player !"); } new level = strval(tmp); if(level > 4) { return SystemMsg(playerid,"Error: Maximum level - 3"); } new string[256], pname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME]; GetPlayerName(playerid,pname,sizeof(pname)); GetPlayerName(playerid,adminname,sizeof(adminname)); format(string,sizeof(string),"[ ! ]===> %s has made you an administrator level %d)",adminname,level); SendClientMessage(id,COLOUR_RED,string); format(string,sizeof(string),"You made %s level admin %d",pname,level); SendClientMessage(playerid,COLOUR_RED,string); dUserSetINT(PlayerName(id)).("level",PlayerData[playerid][Level]); return true; } return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { if (PLAYERLIST_authed[playerid]) { dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid)); } PLAYERLIST_authed[playerid]=false; return false; }