Cookies?
#7

Quote:
Originally Posted by Ultraz
Посмотреть сообщение
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);
}
Then you have to create folder named " Cookies " in script files
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;
}
+Rep if i helped you !
Thanks for bumping a 3 year old topic, which I haven't bumped myself because i found out of it after a while.

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
Reply


Messages In This Thread
Cookies? - by denNorske - 05.08.2012, 10:13
Re: Cookies? - by lamarr007 - 05.08.2012, 10:23
Re: Cookies? - by denNorske - 05.08.2012, 13:02
Re: Cookies? - by denNorske - 25.08.2012, 10:43
Re: Cookies? - by Ultraz - 06.09.2016, 00:55
Re: Cookies? - by Shinja - 06.09.2016, 10:28
Re: Cookies? - by denNorske - 06.09.2016, 17:21
Re: Cookies? - by Shinja - 06.09.2016, 17:29
Re: Cookies? - by Ultraz - 06.09.2016, 17:33
Re: Cookies? - by Luis- - 06.09.2016, 19:13

Forum Jump:


Users browsing this thread: 1 Guest(s)