K so basically i want to script a "/setlevel id level" Command but im not sure how, I want it so i can only give them admin if they are registered and logged in (im using my custom coded admin system in my gm) i tryed this but theres problems:
Код:
dcmd_setlevel(playerid,params[]) {
if(logged[playerid] == 1) {
if(level[playerid] >= 5) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");
new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]");
level = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(logged[player1] == 1) {
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
if(level > 0) format(string,sizeof(string),"Administrator %s has set you to Administrator Status [level %d]",adminname, level);
else format(string,sizeof(string),"Administrator %s has set you to Player Status [level %d]",adminname, level);
SendClientMessage(player1,blue,string);
format(string,sizeof(string),"You have made %s Level %d", playername, level); SendClientMessage(playerid,blue,string);
format(string,sizeof(string),"Administrator %s has made %s Level %d",adminname, playername);
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(player1, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
level[player1] = level[player1]+level;
dini_IntSet(file, "level", level[player1]);
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be admin");
} else return SendClientMessage(playerid, red, "Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Line 411 = new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
Change 'level' to something else. You're already using it somewhere