14.03.2010, 17:53
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;
}
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;
}