Payday problem
#1

Hello, i have my own gamemode, which i started from scratch and i'v created a payday system, it works fine.
but it pays you only 1 hour you play, meaning -> If i logged in at 10:45, i get the paycheck at 11:45. (i'm using a timer of 60000). So what i want is to get paycheck every HOUR, like at 10:00, 11:00, and etc.

Here's the payday! +1 rep for helpers!

Код:
public payday(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
    {
        GameTextForPlayer(i, "~p~PAY~w~DAY", 1000, 1);
        GivePlayerCash(playerid, 1000);
        SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
	    SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~PayDay~~~~~~~~~~");
        SendClientMessage(playerid, COLOR_WHITE,"You have recived a check of 1,000$!");
        SendClientMessage(playerid, COLOR_WHITE,"You also got level up!");
	    SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~~~~~~~~~~~~~~~~~");
    }
    return 1;
}
Reply
#2

You need to set your timer to
Код:
SetTimer( "Payday", 60000, true );
and change your

Код:
public payday(playerid)
{
    new hh, mm, ss;
    gettime( hh, mm, ss );

    
    if( mm == 0 )
    {
         for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
         {
               GameTextForPlayer(i, "~p~PAY~w~DAY", 1000, 1);
               GivePlayerCash(playerid, 1000);
               SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
	       SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~PayDay~~~~~~~~~~");
               SendClientMessage(playerid, COLOR_WHITE,"You have recived a check of 1,000$!");
               SendClientMessage(playerid, COLOR_WHITE,"You also got level up!");
	       SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~~~~~~~~~~~~~~~~~");
         }
    }     
    return 1;
}
And If you want I can make to give random money now every time 1000$
Reply
#3

Quote:
Originally Posted by RenSoprano
Посмотреть сообщение
You need to set your timer to
Код:
SetTimer( "Payday", 60000, true );
and change your

Код:
public payday(playerid)
{
    new hh, mm, ss;
    gettime( hh, mm, ss );

    
    if( mm == 0 )
    {
         for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
         {
               GameTextForPlayer(i, "~p~PAY~w~DAY", 1000, 1);
               GivePlayerCash(playerid, 1000);
               SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
	       SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~PayDay~~~~~~~~~~");
               SendClientMessage(playerid, COLOR_WHITE,"You have recived a check of 1,000$!");
               SendClientMessage(playerid, COLOR_WHITE,"You also got level up!");
	       SendClientMessage(playerid, COLOR_GREENYELLOW,"~~~~~~~~~~~~~~~~~~~~~~~~~~");
         }
    }     
    return 1;
}
And If you want I can make to give random money now every time 1000$
ehm.. random cash would be great thanks.
Reply
#4

Random from what value to what value ?
Reply
#5

change playerid to i, it will give you many errors.

and here is about the random cash you talking about

pawn Код:
new RandomPay = random(50000); //change the value to your cash value you want
GivePlayerMoney(playerid, random); //this will give random money 0 to 50000
change this line

pawn Код:
SendClientMessage(playerid, COLOR_WHITE,"You have recived a check of 1,000$!");
with this

pawn Код:
new string[128];
format(string, sizeof(string), "You have recieve a check of $%i", RandomPay);
SendClientMessage(i, COLOR_WHITE, string);
Reply
#6

Quote:
Originally Posted by Reklez
Посмотреть сообщение
change playerid to i, it will give you many errors.

and here is about the random cash you talking about

pawn Код:
new RandomPay = random(50000); //change the value to your cash value you want
GivePlayerMoney(playerid, random); //this will give random money 0 to 50000
change this line

pawn Код:
SendClientMessage(playerid, COLOR_WHITE,"You have recived a check of 1,000$!");
with this

pawn Код:
new string[128];
format(string, sizeof(string), "You have recieve a check of $%i", RandomPay);
SendClientMessage(i, COLOR_WHITE, string);
That's not very 'clever', maybe use Min, Max ?
Because at Pay Day the player can get 1$, so what the **** ?

pawn Код:
new RandomPay = random( 50000 - 10000 ) + 10000; //change the value to your cash value you want [ ( Max - Min ) + Min ]
GivePlayerMoney( playerid, RandomPay ); //this will give random money 10000 to 50000
PS: You're wrong at the line:
pawn Код:
GivePlayerMoney(playerid, random); //this will give random money 0 to 50000
You have screwed the second parameter:
pawn Код:
GivePlayerMoney(playerid, RandomPay); //this will give random money 0 to 50000
Reply
#7

Ok thanks the random giving money is working, idk about payday i need to wait, but cuz of the "time" i added.
my command /payday(to force paday) doesn't work, dunno why.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)