12.09.2009, 02:29
hey could someone help me coz i have the following script
but when i go make admin it makes me admin not the player id and if i un mark the GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername)); then it comes up with an error
Код:
if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin { new giveplayername; if (PlayerInfo[playerid][pAdmin] >= 5) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0xE60000FF, "USAGE: /makeadmin [playerid] [level 1-5]"); SendClientMessage(playerid, 0xE60000FF, "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, 0xE60000FF, string); PlayerInfo[playerid][pAdmin] = level; format(string, sizeof(string), "You have given %s level %d admin.", PlayerInfo[playerid][pAdmin]); SendClientMessage(playerid, 0xE60000FF, string); } else return SendClientMessage(playerid, 0xE60000FF, "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, 0xE60000FF, string); } } else SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!"); return 1; }