job help
#1

I started makeing a job script and i want to charge a fare for ppl getting in the taxi this is the code i got but it dont start the fair when the players get in ?


public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate==PLAYER_STATE_PASSENGER)
{
new VID=GetPlayerVehicleID(playerid);
if(GetVehicleModel(VID) == 420)
{
SetTimerEx("FareAmmount",1000,1,"i",playerid);
}
}

if(newstate==PLAYER_STATE_DRIVER)
{
new VID=GetPlayerVehicleID(playerid);
if(GetVehicleModel(VID) == 438 || GetVehicleModel(VID) == 420)
{
if(gTeam[playerid] != TEAM_TAXI)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "This taxi is for taxi drivers only.Write /jobs to be a taxi driver.");
}

}
}
return 1;
}
public FareAmmount(playerid)
{
if(gTeam[playerid] == TEAM_TAXI)
{
new fare = TaxiFare[playerid];
new ammount = fare*2;
totaltaxiamount[playerid] += 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
#2

You did something wrong as i see. first of all take a look here:

Код:
if(newstate==PLAYER_STATE_PASSENGER)
  {
   new VID=GetPlayerVehicleID(playerid);
    if(GetVehicleModel(VID) == 420)
   {
   SetTimerEx("FareAmmount",1000,1,"i",playerid);
   }
Which means, when someone enter as passenger the taxi, it starts the public. but look at here(In Public):

Код:
if(gTeam[playerid] == TEAM_TAXI)
  {
  new fare = TaxiFare[playerid];
  new ammount = fare*2;
  totaltaxiamount[playerid] += ammount;
The code starts if the passenger is a taxi driver. So i think that's a problem.. test it and tell me
Reply
#3

so with this code It starts the game text on the passengers screen but the numbers dont change and it dose not take the money from the passenger and give it to the driver ...?


if(newstate==PLAYER_STATE_PASSENGER)
{
new VID=GetPlayerVehicleID(playerid);
if(GetVehicleModel(VID) == 420)
{
SetTimerEx("FareAmmount",1000,1,"i",playerid);
}
}


public FareAmmount(playerid)
{
if(gTeam[playerid] == TEAM_TAXI) reason i have this is so the taxi driver gets paied but hes not
{
new fare = TaxiFare[playerid];
new ammount = fare*2;
totaltaxiamount[playerid] += ammount;
new string[64];
GivePlayerMoney(playerid, -fare);
format(string,64,"%d/sec~n~%d",fare,totaltaxiamount[playerid]);
GameTextForPlayer(playerid,string,999,4);
return 1;
}
return 1;
}



Reply
#4

hmmm maybe GivePlayerMoney? You dont have giveplayermoney for the taxi driver
Reply
#5

Quote:
Originally Posted by DjSterios
hmmm maybe GivePlayerMoney? You dont have giveplayermoney for the taxi driver
yea i do look GivePlayerMoney(playerid, -fare);
Reply
#6

Yeah that takes money from the customer... but do you have GivePlayerMoney to give money to the taxidriver? cuz u said taxi driver does not take money
Reply
#7

Quote:
Originally Posted by DjSterios
Yeah that takes money from the customer... but do you have GivePlayerMoney to give money to the taxidriver? cuz u said taxi driver does not take money
i must not the code i got is what you see and for some reason its not taking money from the player or giving money to the driver either and the time not going
Reply
#8

This is my code now and i have the game text comming up for the passenger but not for the taxi driver also its taking 2 dollers a second from the passenger but not giving it to the driver .And the game tex is staying at 0seconds 0dollars

if(newstate==PLAYER_STATE_PASSENGER)
{
new VID=GetPlayerVehicleID(playerid);
if(GetVehicleModel(VID) == 420)
{
SetTimerEx("FareAmmount",1000,1,"i",playerid);
}
}

public FareAmmount(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
new fare = TaxiFare[playerid];
new ammount = fare*2;
totaltaxiamount[playerid] += ammount;
new string[64];
GivePlayerMoney(playerid, -2);
format(string,64,"%d/sec~n~%d",fare, totaltaxiamount[playerid]);
GameTextForPlayer(playerid,string,999,4);
}
if(gTeam[playerid] == TEAM_TAXI)
{
new fare = TaxiFare[playerid];
new ammount = fare*2;
totaltaxiamount[playerid] += ammount;
new string[64];
GivePlayerMoney(playerid, 2);
format(string,64,"%d/sec~n~%d",fare, totaltaxiamount[playerid]);
GameTextForPlayer(playerid,string,999,4);
return 1;
}
return 1;
}
Reply
#9

anyone?
Reply
#10

bumb
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)