question [rep++]
#1

pawn Код:
forward settime();
public settime()
{
    new string[128],Get[6];
    gettime(Get[3],Get[4],Get[5]);
    getdate(Get[0],Get[1],Get[2]);
   
    foreach(Player, z)
    {
        format( string , 128 , "%02d.%02d.%02d" , Get[ 2 ] , Get[ 1 ] , Get[ 0 ] );
        TextDrawSetString(Clock1[z] , string);
        TextDrawShowForPlayer(z, Clock1[z]);

        format(string ,128,"%02d:%02d", Get[3],Get[4]);
        TextDrawSetString(Clock2[z] , string);
        TextDrawShowForPlayer(z, Clock2[z]);
    }
}
I want to make a public with payday for all factions who i want to work on sunday , hour 20:30 and give the players money automatically .
That is my time public , i don't know how to use it for this type of thing..
Reply
#2

Something like this? Not sure if it works. Thinking about it you may need to know how many times the player had been paid... just a number. Like if it was the 1st last pay, then the 2nd is the next - you would have to know that by maybe reading a file. Maybe save it to file, the player's pays received for the month? I've included it below. You can simply...

pawn Код:
forward settime();
public settime()
{
    new string[128],Get[6];
    gettime(Get[3],Get[4],Get[5]);
    getdate(Get[0],Get[1],Get[2]);
   
    foreach(Player, z)
    {
        format( string , 128 , "%02d.%02d.%02d" , Get[ 2 ] , Get[ 1 ] , Get[ 0 ] );
        TextDrawSetString(Clock1[z] , string);
        TextDrawShowForPlayer(z, Clock1[z]);

        format(string ,128,"%02d:%02d", Get[3],Get[4]);
        TextDrawSetString(Clock2[z] , string);
        TextDrawShowForPlayer(z, Clock2[z]);
    }
    if((Get[2] % 7) && (Get[3] == 18) && (Get[4] == 30) ) //every 7 days at 1800 hours, 30 minutes.
    {
        if((PlayerInfo[playerid][paysthismonth] < (Get[2] % 7) || (Get[2] % 7 < 2)) //how many pays this month, if is less than the x Sunday this month, or if it's the first Sunday (first of the month)...
        if(PlayerInfo[playerid][faction] > 0) //most people use this technique to store player info, so I'll presume you do to.
        {
            new amount = 500; //the amount that you want to give them? Perhaps a different amount for every faction?
            new string[128];
            format(string, sizeof(string), "You have been paid %f for this week.", amount);
            SendClientMessage(playerid, -1, string);
            GivePlayerMoney(playerid, amount);
            if(!(Get[2] % 7 < 2)) //if not the first Sunday of this month.
            {
                PlayerInfo[playerid][paysthismonth]++;
            }
            else
            {
                PlayerInfo[playerid][paysthismonth] = 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)