12.01.2015, 09:18
Hello,
I created an /giveogold but it will crash the server after using it,
I created an /giveogold but it will crash the server after using it,
pawn Код:
CMD:giveogold(playerid, params[])
{
new playerb, amount, string[128], file[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 8) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "s[32]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /giveogold [playername] [amount]");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
format(string, sizeof(string), "AdmWarn: %s has given %s %d gold points(offline).", RPN(playerid), playerb, amount);
SendAdminMessage(COLOR_LIGHTBLUE, 1, string);
Log("logs/givemoney.log", string);
dini_IntSet(file, "Gold", amount);
foreach(Player, i)
{
if(IsPlayerLoggedIn(i) && PlayerInfo[i][pGold] == amount)
{
PlayerInfo[i][pGold] = amount;
format(string, sizeof(string), " Administrator %s Has added Gold Points when you was offline (%d).", RPN(playerid), amount);
SendClientMessage(i, COLOR_PINK, string);
}
}
return 1;
}