CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie { new str[250]; if(PlayerInfo[playerid][Level] >= 3) { if(sscanf(params, "u", playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /givecookie [Player ID]"); if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "PlayerID is not connected."); PlayerInfo[playerid][Cookies] += 1; format(str, sizeof(str), "**Admin %s (ID:%d) has give a cookie to %s.(ID:%d) and %s cookie count is (%d)",PlayerName2(playerid),playerid, PlayerName2(playerid),playerid,PlayerName2(playerid),PlayerInfo[playerid][Cookies]); SendClientMessageToAll(COLOR_ORANGE, str); GameTextForPlayer(playerid,"~g~~h~~h~Cookie",3000,4); format(str, sizeof(str), "**You just gave a cookie to %s.", PlayerName2(playerid)); SendClientMessage(playerid, COLOR_GREEN, str); } else SendClientMessage(playerid, COLOR_YELLOW, "**You're not authorized to use this command."); return 1; }
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie
{
new str[250], player, amount;
if(PlayerInfo[playerid][Level] >= 3)
{
if(sscanf(params, "ui", player, amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /givecookie [Player ID] [Amount]");
if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_YELLOW, "PlayerID is not connected.");
PlayerInfo[player][Cookies] += amount;
format(str, sizeof(str), "**Admin %s (ID:%d) has given %d cookie(s) to %s.(ID:%d) and %s cookie count is (%d)",PlayerName2(player),player, amount, PlayerName2(player),playerid,PlayerName2(player),PlayerInfo[player][Cookies]);
SendClientMessageToAll(COLOR_ORANGE, str);
GameTextForPlayer(player,"~g~~h~~h~Cookie",3000,4);
format(str, sizeof(str), "**You just gave %d cookie(s) to %s.", amount, PlayerName2(player));
SendClientMessage(playerid, COLOR_GREEN, str);
}
else SendClientMessage(playerid, COLOR_YELLOW, "**You're not authorized to use this command.");
return 1;
}
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie
{
new str[250], id, cookies;
if(PlayerInfo[playerid][Level] >= 3)
{
if(sscanf(params, "ud", id, cookies)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /givecookie [Player ID] [COOKIES]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "PlayerID is not connected.");
PlayerInfo[id][Cookies] += cookies;
format(str, sizeof(str), "**Admin %s (ID:%d) has give %d cookie to %s.(ID:%d) and %s cookie count is (%d)",PlayerName2(playerid),playerid, cookies, PlayerName2(id),playerid,PlayerName2(id),PlayerInfo[id][Cookies]);
SendClientMessageToAll(COLOR_ORANGE, str);
GameTextForPlayer(id,"~g~~h~~h~Cookie",3000,4);
format(str, sizeof(str), "**You just gave a cookie to %s.", PlayerName2(id));
SendClientMessage(playerid, COLOR_GREEN, str);
}
else SendClientMessage(playerid, COLOR_YELLOW, "**You're not authorized to use this command.");
return 1;
}
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie { new str[250], player, amount; if(PlayerInfo[playerid][Level] >= 3) { if(sscanf(params, "ui", player, amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /givecookie [Player ID] [Amount]"); if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_YELLOW, "PlayerID is not connected."); PlayerInfo[player][Cookies] += amount; format(str, sizeof(str), "**Admin %s (ID:%d) has given %d cookie(s) to %s.(ID:%d) and %s cookie count is (%d)",PlayerName2(player),player, amount, PlayerName2(player),playerid,PlayerName2(player),PlayerInfo[player][Cookies]); SendClientMessageToAll(COLOR_ORANGE, str); GameTextForPlayer(player,"~g~~h~~h~Cookie",3000,4); format(str, sizeof(str), "**You just gave %d cookie(s) to %s.", amount, PlayerName2(player)); SendClientMessage(playerid, COLOR_GREEN, str); } else SendClientMessage(playerid, COLOR_YELLOW, "**You're not authorized to use this command."); return 1; }
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;
}
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;
}
Add this near your stocks:
PHP код:
PHP код:
|
if(sscanf(params, "i",amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /giveallcookie [Amount]");;
SendClientMessageToAll(COLOR_ORANGE, str);;
So many copy pasta, no explanation.
He'd just keep making requests and you guys would script it for him and he wouldn't understand what the heck is in the code. I've noticed no one fixed the "str" length from 250 to 145, because SendClientMessage just won't send beyond that. @aoky, you have double semi colon Код:
if(sscanf(params, "i",amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /giveallcookie [Amount]");; Код:
SendClientMessageToAll(COLOR_ORANGE, str);; |
So many copy pasta, no explanation.
He'd just keep making requests and you guys would script it for him and he wouldn't understand what the heck is in the code. I've noticed no one fixed the "str" length from 250 to 145, because SendClientMessage just won't send beyond that. @aoky, you have double semi colon Код:
if(sscanf(params, "i",amount)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /giveallcookie [Amount]");; Код:
SendClientMessageToAll(COLOR_ORANGE, str);; |