Problem with taxi script
#5

Today is the "tomorrow"!

Ok lets start.

First i would suggest you to change the "new taxiride/taxicost[MAX_PLAYERS]" to PVars.(I will talk about that later)

Fixing the timers.

Part 1:
Change the SetTimer("TaxiCost"......
to SetPVarInt(playerid, "TaxiTimer", SetTimerEx("TaxiCost", 10000, false, "i", playerid);

Part 2:
Change the KillTimer(taxitimer);
to KillTimer(GetPVarInt(playerid, "TaxiTimer"));

After changing these 2 things, taxi cost will work fine for ALL ids and not only for ID 0, as it is now.
Also it would be better to add at OnPlayerDisconnect
pawn Код:
if(GetPVarInt(playerid, "TaxiTimer") != 0) KillTimer(GetPVarInt(playerid, "TaxiTimer"));
By adding this, when a player is in taxi as passenger and he disconnects, it will kill the timer.

Changing the taxiride/taxicost into PVars

Part 1:
Remove the
"new taxiride[MAX_PLAYERS];"
and
"new taxicost[MAX_PLAYERS];"

Part 2:
Change this in the TaxiCost timer
taxicost[playerid] += 50;
to
SetPVarInt(playerid, "TaxiCost", GetPVarInt(playerid, "TaxiCost")+50);
AND
format(tstring, sizeof(tstring),"Taxicost: $%d",taxicost[playerid]);
to
format(tstring, sizeof(tstring),"Taxicost: $%d",GetPVarInt(playerid, "TaxiCost"));

Part 3:
Replace all the other taxicost/taxiride into PVars
taxiride[playerid] = 1;
to
SetPVarInt(playerid, "TaxiRide", 1);
AND
taxicost[playerid] = 0;
to
SetPVarInt(playerid, "TaxiCost");

And yeah! I finished. After doing all these everything will work fine!
Reply


Messages In This Thread
Problem with taxi script - by sean5874 - 02.05.2010, 18:03
Re: Problem with taxi script - by Dark_Kostas - 02.05.2010, 18:15
Re: Problem with taxi script - by sean5874 - 02.05.2010, 18:49
Re: Problem with taxi script - by sean5874 - 03.05.2010, 08:03
Re: Problem with taxi script - by Dark_Kostas - 03.05.2010, 15:49

Forum Jump:


Users browsing this thread: 1 Guest(s)