06.09.2016, 17:21
Quote:
Sure for Example if you are admin you have to use this to give cookie
Код:
CMD:givecookie(playerid, params[]) { if(pInfo[playerid][pLevel] >= 1) // Change this to your system stuff { new pid; new str[250]; if(sscanf(params, "u", pid)) return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "USAGE: /givecookie [Player ID]"); if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "PlayerID is not connected."); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); PlayerPlaySound(pid, 1057, 0.0, 0.0, 0.0); pPinfo[pid][Cookies] += 1; format(str, sizeof(str), "-Server- Admin %s (ID:%d) Gave %s(ID: %d) A Cookie [Total: %d] ",GetName(playerid),playerid,GetName(pid),pid,pPinfo[pid][Cookies]); //Change the text if you want SendClientMessageToAll(COLOR_GREEN, str); GameTextForPlayer(pid,"~g~~h~~h~Cookie!",3000,4); // Change this GameText if you want */new string[134],cookie[100]; format(cookie, sizeof(cookie), "02 03* 7,15 Admin %s (ID:%d) Gave %s(ID: %d) A Cookie [Total: %d] .", GetName(playerid),playerid,GetName(pid),pid,pPinfo[pid][Cookies]); IRC_GroupSay(groupID, IRC_CHANNEL, cookie);/* // Use this if you have a IRC System inside the Admin system return 1; } else return ShowMessage(playerid,red,1); } to make the cookies being saved: Код:
enum Ppinfo { Cookies } Код:
OnPlayerDisconnect INI_WriteInt(file,"Cookies",pPinfo[playerid][Cookies]); Код:
#define COLOR_MESSAGE_YELLOW 0xFFDD00AA #define UserPath "cookies/%s.ini" stock Path(playerid) { new str[128],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(str,sizeof(str),UserPath,name); return str; } |
However, if you were helping a newbie, I would suggest you to use the stock functions to avoid confusing people what to do, and stick to the problem only
