28.01.2013, 00:16
How would i make it that The passenger pays the driver.
Because at the moment it wont pay the driver & it doesnt take any money off passenger
All help apreciated.
Heres What i got so far. Its and Include Btw
Because at the moment it wont pay the driver & it doesnt take any money off passenger
All help apreciated.
Heres What i got so far. Its and Include Btw
pawn Код:
#include <a_samp>
#define COLOR_YELLOW 0xffff00FF
new taxiride[MAX_PLAYERS];
new taxicost[MAX_PLAYERS];
public EnterVehicle(playerid, vehicleid, ispassenger)
{
new seat;
new veh;
veh = GetVehicleModel(vehicleid);
seat = GetPlayerVehicleSeat(playerid);
if(veh == 420) //taxi id
{
if(seat > 0) // we dont show the timer if the player is a driver
{
SetPVarInt(playerid, "TaxiTimer", SetTimerEx("TaxiCost", 10000, false, "i", playerid));
SendClientMessage(playerid, COLOR_YELLOW,"You has entered the taxi as a passenger.");
SetPVarInt(playerid, "-TaxiRide", 1);
SetPVarInt(playerid, "-TaxiCost", 0);
}
return 1;
}
return 1;
}
public ExitVehicle(playerid, vehicleid)
{
KillTimer(GetPVarInt(playerid, "TaxiTimer"));
if(taxiride[playerid] == 1)
{
new dvehicle;
new pvehicle;
new seat;
new tstring2[128];
new tstring3[128];
format(tstring2, sizeof(tstring2),"~g~paid: $%d!",taxicost[playerid]);
GameTextForPlayer(playerid, tstring2, 4000, 1);
format(tstring3, sizeof(tstring3),"You have exited the taxi. You have paid $%d to the taxi driver.",taxicost[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, tstring3);
taxiride[playerid] = 0;
GameTextForPlayer(playerid,"_",10000, 1);
SetPVarInt(playerid, "PVarMoney", -taxicost[playerid]);
pvehicle = GetPlayerVehicleID(playerid);
for(new i=0; i<MAX_PLAYERS; i++) /// look for the taxi drivers id
{
if(IsPlayerInVehicle(i, 420))
{
dvehicle = GetPlayerVehicleID(i);
if(dvehicle == pvehicle)
{
seat = GetPlayerVehicleSeat(i);
if(seat == 0)
{
new dstring[128];
SetPVarInt(playerid, "PVarMoney", taxicost[playerid]);
format(dstring, sizeof(dstring),"Your passenger has exited your taxi, your earnings: $%d",taxicost[playerid]);
SendClientMessage(i, COLOR_YELLOW, dstring);
taxicost[playerid] = 0;
continue;
}
}
}
}
}
return 1;
}
forward TaxiCost(playerid);
public TaxiCost(playerid)
{
if(taxiride[playerid] == 1)
{
new tstring[128];
SetPVarInt(playerid, "TaxiCost", GetPVarInt(playerid, "TaxiCost")+50);
format(tstring, sizeof(tstring),"Taxicost: $%d",GetPVarInt(playerid, "TaxiCost"));
GameTextForPlayer(playerid, tstring, 10000, 1);
}
return 1;
}