02.01.2016, 13:57
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/makeadmin", true) == 0) { new string[128]; new tmp[256]; new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME]; new giveplayerid; if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdminLevel]<4)return SendClientMessage(playerid,0xFF0000FF,"Ne moћete koristiti ovu komandu!"); { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, 0x00C2ECFF, "SERVER: /makeadmin [ID igrača] [level]"); return 1; } giveplayerid = ReturnUser(tmp); tmp = strtok(cmdtext, idx); new level = strval(tmp); if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, player, sizeof(player)); PlayerInfo[giveplayerid][pAdminLevel] = level; printf("Admin %s je dao %s level %d admina.", player, giveplayer, level); format(string, sizeof(string), "Sada ste Game Admin levela %d, dodao vas je %s.", level, player); SendClientMessage(giveplayerid, 0x00C2ECFF, string); format(string, sizeof(string), "Dali ste %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][pAdminLevel]); SendClientMessage(playerid, 0x00C2ECFF, string); } else if(giveplayerid == INVALID_PLAYER_ID) { format(string, sizeof(string), "%i nije aktivan igrač.", giveplayerid); SendClientMessage(playerid, 0xE60000FF, string); } } return 1; } return SendClientMessage(playerid,0xFF0000AA,"SERVER: Unijeli ste nepostojeću komandu."); }