12.12.2009, 08:30
Hello, I've got a problem. I'm making a script, but when I make myself admin IG it doesn't save to my userfile. Any ideas why?
if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin
{
if (PlayerInfo[playerid][AdminLevel] >= 1337 || IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /makeadmin [playerid] [level 1-1338]");
SendClientMessage(playerid, COLOR_ORANGE, "FUNCTION: Player will be an admin depending on the given level.");
return 1;
}
//new giveplayerid = ReturnUser(tmp, playerid);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
if (level >= 0)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
printf("ADMIN: %s made %s a level %d admin.", sendername, giveplayername, level);
format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "|- Administrator %s has given %s an Admin Level. [Level: %d] -|", sendername,giveplayername,level);
SendClientMessageToAdmins(COLOR_RED, string, 1);
PlayerInfo[giveplayerid][AdminLevel] = level;
format(string, sizeof(string), "You have given %s level %d admin.", giveplayername,PlayerInfo[giveplayerid][AdminLevel]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else return SendClientMessage(playerid, COLOR_RED, "You can't go below level 0!");
}
else if(giveplayerid == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%i is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else SendClientMessage(playerid, COLOR_RED, "You are not a lead admin!");
return 1;
}