Taxi Fare gametext
#1

i tried to make a gametext that will show money deacreasing while sitting in a taxi.
i made this but it fails and i added a timer
Код:
public FareAmmount(playerid)
{
	if(AccountInfo[playerid][Job] != 1)
	{
	new fare = TaxiFare[playerid];
	new ammount = fare*2;
	new string[64];
	
	GivePlayerMoney(playerid,-fare);
	
	format(string,64,"%d/sec~n~%d",fare,ammount);
	GameTextForPlayer(playerid,string,999,4);
	}
	else return 1;
	return 1;
}
timer is under "onplayerstatechange"
Код:
if(IsATaxi(vehicleid) && PLAYER_STATE_PASSENGER)
	{
		SetTimer("FareAmmount",1000,1);
	}
Reply
#2

Try this one:

pawn Код:
if(IsATaxi(vehicleid) && newstate == PLAYER_STATE_PASSENGER)
    {
        SetTimerEx("FareAmmount",1000,1,"i",playerid);
    }
Reply
#3

the gametext works but the "ammount" is wrong.I dont know how to set it that it will change every second.Bcz the fare like for example $2/sec , that means 1 second it is $2 but the 2 second it is 4$. Fare*seconds.How to set those seconds so they will increase.Thanks
Reply
#4

bump ? you understand what i want ?
Reply
#5

are you wanting the fare to double every second or do you want to add $2 every second?
Reply
#6

Quote:
Originally Posted by Naruto4
bump ? you understand what i want ?
pawn Код:
SetTimerEx("FareAmmount",1000,1,"i",playerid); //1 it will repeat again and again if the player is in taxi.
So if someone is in taxi it will repeat it again and again it will -2 dollars on every second.
Reply
#7

Put this on the top of your script:
Код:
new totaltaxiamount[MAX_PLAYERS]
or put it in enum
then:
Код:
public FareAmmount(playerid)
{
	if(AccountInfo[playerid][Job] != 1)
	{
	new fare = TaxiFare[playerid];
	new ammount = fare*2; 
	totaltaxiamount[playerid] += ammount;
	//or AccountInfo[playerid][totaltaxiamount] += ammount;
	new string[64];
	
	GivePlayerMoney(playerid,-fare);
	
	format(string,64,"%d/sec~n~%d",fare,totaltaxiamount[playerid]);
	GameTextForPlayer(playerid,string,999,4);
	}
	else return 1;
	return 1;
}
Reply
#8

nice idea.thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)