Extra bonus, on a specific day.
#1

I need a help about that, if it's the week-end players will get extra bonuses

Ex :

If it's not the week-end players will get:

pawn Код:
CMD:guns(playerid,params[])
{
    GivePlayerWeapon(playerid, 30, 200);
    GivePlayerWeapon(playerid, 26, 200);
    GivePlayerWeapon(playerid, 24, 200);
}
But if it is week-end

pawn Код:
CMD:guns(playerid,params[])
{
  //if it's the week-end
    GivePlayerWeapon(playerid, 30, 400);
    GivePlayerWeapon(playerid, 26, 400);
    GivePlayerWeapon(playerid, 24, 400);
}
Thanks in advance.
Reply
#2

you can make something like this
pawn Код:
new  day, month, year; getdate(day, month year);
if(day == (saturday etc...)
Reply
#3

Quote:
Originally Posted by JustBored
Посмотреть сообщение
you can make something like this
pawn Код:
new  day, month, year; getdate(day, month year);
if(day == (saturday etc...)
I'm not really sure, that i know how to use it, can you explain mroe or show me a helpful topic?
Reply
#4

pawn Код:
CMD:guns(playerid,params[])
{
    new  day, month, year; getdate(day, month year);
    if(day == (saturday)
    {
    GivePlayerWeapon(playerid, 30, 400);
    GivePlayerWeapon(playerid, 26, 400);
    GivePlayerWeapon(playerid, 24, 400);
    return 1;
    }
        if(day == (sunday)
    {
    GivePlayerWeapon(playerid, 30, 400);
    GivePlayerWeapon(playerid, 26, 400);
    GivePlayerWeapon(playerid, 24, 400);
    return 1;
    }
    else
    {
    GivePlayerWeapon(playerid, 30, 200);
    GivePlayerWeapon(playerid, 26, 200);
    GivePlayerWeapon(playerid, 24, 200);
    return 1;
    }
   
}
Reply me the results and rep+ will be appreciated!
Reply
#5

do you mean weekend in real life ... or weekend in your script( then it should be defined and u should know how to put this in examples above)
Reply
#6

One prob, it's says
Код:
error 017: undefined symbol "saturday"
error 017: undefined symbol "sunday"
Reply
#7

Something like
pawn Код:
new days = getdate(); new day, year, month; getdate(year, month, day);
if(day == days/7) // If day is tuesday since 1 jan 2013 was a tuesday
I could be wrong.. Correct me if I am!
Reply
#8

I could also be wrong but that is the basic idea I can think of.

pawn Код:
GetDayName(name[])
{
    new tmp,day,name[10];
    getdate(day,tmp,tmp);
    if(day==1)format(name,sizeof(name),"Monday");
    if(day==2)format(name,sizeof(name),"Tuesday");
    if(day==3)format(name,sizeof(name),"Wednesday");
    if(day==4)format(name,sizeof(name),"Thursday");
    if(day==5)format(name,sizeof(name),"Friday");
    if(day==6)format(name,sizeof(name),"Saturday");
    if(day==7)format(name,sizeof(name),"Sunday");
}
Reply
#9

I wrote a Days.inc for this after reading the request.
Couldn't find a better way, although i'm not sure if it's the BEST way, but it's the only way I could find

http://forum.sa-mp.com/showthread.ph...13#post2526913

pawn Код:
CMD:guns(playerid,params[])
{
    new day;
    day = GetDayToday();
    if(day == SATURDAY || day == SUNDAY)
    {
        GivePlayerWeapon(playerid, 30, 400);
        GivePlayerWeapon(playerid, 26, 400);
        GivePlayerWeapon(playerid, 24, 400);
    }
    else
    {
        GivePlayerWeapon(playerid, 30, 200);
        GivePlayerWeapon(playerid, 26, 200);
        GivePlayerWeapon(playerid, 24, 200);
    }
    return 1;
}
Reply
#10

Quote:
Originally Posted by DeMoX
Посмотреть сообщение
I'm not really sure, that i know how to use it, can you explain mroe or show me a helpful topic?
I was refering that you have to put there the number so the function should be like this
pawn Код:
new day, month year;
getdate(day, month, year);
if(day == 18) //today that is saturday - 18 - may
{
//code
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)