05.12.2015, 06:41
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(id));
INI_SetTag(file,"ColourText Player's Data");
INI_WriteInt(file,"ColourText",1);
INI_Close(file);
return 1;
}
CMD:takecolourtext(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}/takecolourtext (id)");
if(pInfo[id][ColourText] == 0) return SendClientMessage(playerid,COLOR_RED, "[ERROR]{FFFFFF}: That player doesnot have colourtext, How can you take it?");
GetPlayerName(playerid, idname, sizeof(idname));
format(string, sizeof(string), "You have taken %s(%d)'s' colour text.",idname,id);
SendClientMessage(playerid, -1, string);
SendClientMessage(id, -1, "An administrator has taken your ColourText. You cannot now use /colourtext anymore");
new INI:file = INI_Open(Path(id));
INI_SetTag(file,"ColourText Player's Data");
INI_WriteInt(file,"ColourText",0);
INI_Close(file);
return 1;
}
eg: if colourtext = 0 it remains 0