sa-mp taxi script Code Done Small Problem
#1

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
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;
}
Reply
#2

Inside the public ExitVehicle()

Add
PHP код:
PlayerInfo[playerid][pCash]+=amount;
GivePlayerMoney(playeridplayerid); 
[/php]
Reply
#3

ive done what you have said and it gave me errors

errors i get are
pawn Код:
pawno\include\MyTaxiShiitz.inc(50) : warning 215: expression has no effect
pawno\include\MyTaxiShiitz.inc(50) : error 001: expected token: ";", but found "]"
pawno\include\MyTaxiShiitz.inc(50) : error 029: invalid expression, assumed zero
pawn Код:
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]);
        PlayerInfo[playerid][pCash]+=amount; <-- error
        RewardPlayer(playerid, 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;
}
Reply
#4

So then change the variables accordingly. That's just the basics of what it is
Reply
#5

Updated look at post above
Reply
#6

anyone help wit the error
Reply
#7

Change the ammount to taxicost[playerid]; i think
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)