21.02.2016, 18:48
PHP код:
CMD:dmwinner(playerid,params[])
{
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid,COLOR_LIGHTRED, "Logheazate mai intai");
// You can use ! which is equal to == 0
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_LIGHTRED,"Nu ai nivelul de admin necesar");
// Shortened few lines doing the above
new idw, prize;
if(sscanf(params, "ui",idw,prize)) return SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /dmwinner <Name/Playerid> <Prize>");
if(idw == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Acel player nu este conectat");
new str[60], name[MAX_PLAYER_NAME]; // you need to create a string to format the message below and a name array to get the player's name
GetPlayerName(idw, name, sizeof(name)); // here we get the target player's name
format(str,sizeof(str), "%s a castigat eventul DM! Felicitari", name); // we have to format the message
SendClientMessageToAll(COLOR_GREEN, str); // show the message to everybody
GivePlayerCash(idw, prize); // give the money, amount defined using /dmwinner <playerid> <money>
activeevent = 0;
return 1;
}