10.12.2014, 11:38
Hello guys! I have a problem.
Why it don't works? Please help.
code:
CMD:
GetPlayerID:
Why it don't works? Please help.
code:
CMD:
Код:
CMD:setlevel(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return true; new mysql_query[128]; if(sscanf(params,"dd", params[0], params[1])) return SendClientMessage(playerid, COLOR_YELLOW, "use: /setlevel [account id] [level]"); if(IsPlayerConnected(GetPlayerID(params[0]))) { PlayerInfo[params[0]][pAdminLevel] = params[1]; } else if(!IsPlayerConnected(GetPlayerID(params[0]))) { format(mysql_query, sizeof(mysql_query), "UPDATE `accounts` SET `pAdmin` = '%d' WHERE `id` = '%d'",params[1], params[0]); mysql_function_query(connects, mysql_query, false, "", ""); } SendClientMessage(playerid, COLOR_YELLOW, "bla-bla-bla"); return true; }
Код:
stock GetPlayerID(string[]) { foreach(Player,i) { if(IsPlayerConnected(i) == 1) { if(strcmp(PlayerInfo[i][pNickName], string, true, strlen(string)) == 0) { return i; } } } return INVALID_PLAYER_ID; }