20.12.2017, 16:26
Add this near your stocks:
Then add this:
Written from here, so I'm unsure of the errors. Just reply if there are any.
PHP код:
forward GiveAllCookies(playerid, amount);
public GiveAllCookies(playerid, amount)
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerInfo[i][Cookies] += amount;
}
}
return 1;
}
PHP код:
CMD:giveallcookie(playerid, params[]) // CMD for giving somebody a cookie
{
new str[250], amount;
if(PlayerInfo[playerid][Level] >= 3)
{
if(sscanf(params, "i",amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /giveallcookie [Amount]");;
format(str, sizeof(str), "**Admin %s (ID:%d) has given %d cookie(s) to everyone!",PlayerName2(playerid), playerid, amount);
SendClientMessageToAll(COLOR_ORANGE, str);;
format(str, sizeof(str), "**You just gave %d cookie(s) to everyone.", amount);
SendClientMessage(playerid, COLOR_GREEN, str);
GiveAllCookies(playerid, amount);
}
else SendClientMessage(playerid, COLOR_YELLOW, "**You're not authorized to use this command.");
return 1;
}