SA-MP Forums Archive
Taxi fare duty - 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)
+--- Thread: Taxi fare duty (/showthread.php?tid=604207)



Taxi fare duty - NeXoR - 01.04.2016

Heya guys
I'm working on a roleplay script and I decided to improve my Taxi's system
I would like to script a fare system which the driver could set a price per minute/second or so
I have two questions:

1. Can you guys just suggest me in which publics should I use it ? OnPlayerStateChange seems to suit the best
2. How am I supposed to do the counting ? Simply FareVariable[playerid]++ ? It won't be accurate


Re: Taxi fare duty - introzen - 02.04.2016

Create a callback (TaxiFare) where you use something like FareVariable[playerid]++.

Call a timer on command from the taxidriver, /startmeter <playerid>.

SetTimerEx("TaxiFare", 1000, 1, "i", id);

Make sure to check if the given id is in the same vehicle as the driver. Also make sure to check if it's vehicle id 420.


Re: Taxi fare duty - NeXoR - 02.04.2016

Quote:
Originally Posted by introzen
Посмотреть сообщение
Create a callback (TaxiFare) where you use something like FareVariable[playerid]++.

Call a timer on command from the taxidriver, /startmeter <playerid>.

SetTimerEx("TaxiFare", 1000, 1, "i", id);

Make sure to check if the given id is in the same vehicle as the driver. Also make sure to check if it's vehicle id 420.
I thought about to set a fare once you go on duty
for example: /fare 60 - on player state change - passenger - 60 dollar per sec - when the player exits it gives the driver the full amount


Re: Taxi fare duty - NeXoR - 02.04.2016

Anyone ? How can I do the counting


Re: Taxi fare duty - JohnBlaze1971 - 03.04.2016

Its an easy task.
Код:
OnPlayerEnterVehicle
{
//if the driver is pulic driver then
new fareamount[MAX_PLAYERS];
Set timer here
}
Now in timer of each min or whatever you want
Код:
fareamount[playerid] += money
Remember that here playerid is the coustmer.

Then on player exit vehicle
Код:
-money for player
+money for driver
Thank you. I hoped I helped there.
- John_Blaze ( WSRPG )


Re: Taxi fare duty - NeXoR - 03.04.2016

Quote:
Originally Posted by JohnBlaze1971
Посмотреть сообщение
Its an easy task.
Код:
OnPlayerEnterVehicle
{
//if the driver is pulic driver then
new fareamount[MAX_PLAYERS];
Set timer here
}
Now in timer of each min or whatever you want
Код:
fareamount[playerid] += money
Remember that here playerid is the coustmer.

Then on player exit vehicle
Код:
-money for player
+money for driver
Thank you. I hoped I helped there.
- John_Blaze ( WSRPG )
Well it was harder than you claimed, thanks anyways you gave me the basic : )