07.12.2015, 11:49
PHP код:
CMD:givecolourtext(playerid,params[])
{
new id,idname[MAX_PLAYER_NAME],string[128];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}: You are not authorised to use this command");
if(isnull(params)) return SendClientMessage(playerid,COLOR_RED,"Usage: {FFFFFF}/givecolourtext (id)");
if(pInfo[id][ColourText] == 1) return SendClientMessage(playerid,COLOR_RED, "[ERROR]{FFFFFF}: That player already have colourtext, How can you give it twice?");
GetPlayerName(playerid, idname, sizeof(idname));
format(string, sizeof(string), "You have given %s(%d) colour text.",idname,id);
SendClientMessage(playerid, -1, string);
SendClientMessage(id, -1, "An administrator has given you ColourText. You can now use /colourtext");
new INI:File = INI_Open(path);
INI_SetTag(File, "data");
INI_WriteInt(File, "ColourText", 1);
INI_Close(File);
return 1;
}
example of a stats saving stock, you can use it in OnPlayerDisconnect or in the command too.
PHP код:
stock SaveStats(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"ColourText",pInfo[id][ColourText]);
return 1;
}