SA-MP Forums Archive
Giving players with jobs an item after 1 day? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Giving players with jobs an item after 1 day? (/showthread.php?tid=94034)



Giving players with jobs an item after 1 day? - coole210 - 27.08.2009

Okay i have an RPG server and im asking how to check when a person last logs in and buys an item, then when he buys it, he has to wait 1 more day and he can get it again. How do i make this?

NOTE: i know i can just add this:
pawn Код:
new year,month,day,hour,minute,second;
and then...

pawn Код:
getdate(year,month,day);
gettime(hour,minute,second);
But i dunno the rest ! Please help.


Re: Giving players with jobs an item after 1 day? - MenaceX^ - 27.08.2009

pawn Код:
if(hour==12.. blabla



Re: Giving players with jobs an item after 1 day? - coole210 - 27.08.2009

I don't get it, i can save, but how do i disallow them to get the item again before 1 day?

is it this? if(!day+1) return SendClientMessage(playerid,color,"[ ! ] Cannot get another item today, come back tomorrow"); ?


Re: Giving players with jobs an item after 1 day? - coole210 - 27.08.2009

pawn Код:
if (!strcmp("2", tmp, true)) if(Logged[playerid] == 1)
    {
    new year,month,day;
    if((getdate(year,month,day)-LastEcard[playerid]) < 1)
    {
    format(string, 128, "[ ! ] You have to wait %d days before you can get another Item !", (1-(getdate(year,month,day)-LastItem[playerid])));
    SendClientMessage(playerid, c_r, string); return 1;
    }
    if(GetPlayerJobID(playerid) == 9) return 0;
    if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid,c_r,"[ ! ] You need $10 to buy an item !");
    GivePlayerItem(playerid,1);
    SendClientMessage(playerid,COLOR_GREEN,"[ ! ] You have gotten 1 item!");
    GivePlayerMoney(playerid,-10);
    LastItem[playerid] == getdate(year,month,day);
    return 1;
    }