How do I connect the timer to the payer?? Very simple script!! -
qkac1234 - 14.01.2013
Hi, i need help in my job system. It will be a very simple script.
The player can use /jobs to choose the job what he want. And then he get a car and new skin. And he earn 750 dollars every 5 minutes.
this is the timer:
Код:
SetTimer("paytime", 10000, true);
This is the command: (zcmd)
Код:
CMD:jobs(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_1, DIALOG_STYLE_LIST, "Choose one!","police man \nFireman\nsomething","ok","cancel");
return 1;
}
this is the response:
Код:
{
if(dialogid == DIALOG_1)
{
if(response == 1)
{
switch(listitem)
{
case 0: // This case is the important!!!
{
static Float: pX, Float: pY, Float: pZ;
GetPlayerPos( playerid, pX, pY, pZ );
CreateVehicle( 522, pX + 2.0, pY + 2.0, pZ, 0.0, -1, -1, 1000 );
SendClientMessage(playerid, 0x38FF06FF, "Now, you are a Police man" );
// I NEED HELP HERE ...
GivePlayerMoney(playerid, 750);
}
case 1:
{
static Float: pX, Float: pY, Float: pZ;
GetPlayerPos( playerid, pX, pY, pZ );
CreateVehicle( 562, pX + 2.0, pY + 2.0, pZ, 0.0, -1, -1, 1000 );
SendClientMessage(playerid, 0x38FF06FF, "not important!" );
}
case 2:
{
static Float: pX, Float: pY, Float: pZ;
GetPlayerPos( playerid, pX, pY, pZ );
CreateVehicle( 520, pX + 2.0, pY + 2.0, pZ, 0.0, -1, -1, 1000 );
SendClientMessage(playerid, 0x38FF06FF, "asd!" );
}
}
}
else
{
SendClientMessage(playerid, 0xEB000FFF, "Cancelled :(");
}
return 1;
}
return 1;
}
So, how should I connect the timer to the money?
I hope you can help me! Thanks.
Re: How do I connect the timer to the payer?? Very simple script!! -
park4bmx - 14.01.2013
pawn Код:
SetTimer("PayTime", 10000, true);
forward PayTime();
public PayTime()
{
for(new playerid=0, playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid)
{
GivePlayerMoney(playerid,750);
}
}
return 1;
}
Re: How do I connect the timer to the payer?? Very simple script!! -
qkac1234 - 14.01.2013
This code, gives money to all players. Not only who doing job.
Re: How do I connect the timer to the payer?? Very simple script!! -
park4bmx - 14.01.2013
yes because i didn't see you using any variable to store the player job so i couldn't do anything.
Re: How do I connect the timer to the payer?? Very simple script!! -
qkac1234 - 14.01.2013
Okey, so how can i add a new varible? And where?
Re: How do I connect the timer to the payer?? Very simple script!! -
park4bmx - 14.01.2013
there are many ways, here is 1 way of doing it
pawn Код:
#define POLICE 1
#define FIREMAN 2
new PlayerJob[MAX_PLAYERS];
//then later on when the player chooses for example police
PlayerJob[playerid]=POLICE;
//now tthe pay day with the check
forward PayTime();
public PayTime()
{
for(new playerid=0, playerid<MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid) && PlayerJob[playerid]!=0) GivePlayerMoney(playerid,750);
}
return 1;
}
Re: How do I connect the timer to the payer?? Very simple script!! -
qkac1234 - 14.01.2013
Thanks. This is what i need!
Where do i insert the "PlayerJob[playerid]=POLICE;" to my code? OnDialogResponse? Or where?
Sorry for my stupid questions...