06.03.2012, 21:53
Quote:
I didn't quite get your problem. Do you want an command that reads the value stored inside a flatfile?
|
Here's the givecookie command.
pawn Код:
CMD:givecookie(playerid, params[]) // CMD for giving somebody a cookie
{
new pid;
new reason[128];
new str[128];
if(sscanf(params, "us[128]", pid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecookie [Player ID] [Reason]");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "PlayerID is not connected.");
if(PlayerInfo[playerid][pAdmin]>=2)
{
format(str, sizeof(str), "%s has been granted a cookie by Administrator %s. Reason: (%s)", GetName(pid), GetName(playerid), reason);
SendClientMessageToAll(COLOR_ORANGE, str);
format(str, sizeof(str), "You just gave a cookie to %s.", GetName(pid));
SendClientMessage(playerid, COLOR_GREEN, str);
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
INI_Close(File);
PlayerInfo[pid][pCookies] ++;
}
else SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command.");
return 1;
}