taxi light help
#1

I use the mmartin taxilight script from:

http://forum.ls-rp.com/viewtopic.php?f=592&t=274051

but when i compile i get this invalid func or dec. error at this part:
if(isTaxi[GetPlayerVehicleID(playerid)])
and
the else and return 1;

#include <a_samp>
#include zcmd
#include streamer

new lastcar[MAX_PLAYERS];
new objTaxi[MAX_VEHICLES];
new isTaxi[MAX_VEHICLES];

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}


CMD:maketaxi(playerid, params[]);
// if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1,"Error: You aren't in a premier.");
// if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 426) return SendClientMessage(playerid, -1,"Error: You aren't in a premier.");
if(isTaxi[GetPlayerVehicleID(playerid)])
{
DestroyObject(objTaxi[GetPlayerVehicleID(playerid)]);
isTaxi[GetPlayerVehicleID(playerid)]==false;
}
else
{
objTaxi[GetPlayerVehicleID(playerid)] = CreateObject(19308,0,0,0,0,0,0);
AttachObjectToVehicle(objTaxi[GetPlayerVehicleID(playerid)], GetPlayerVehicleID(playerid), 0, -0.5, 0.94, 0, 0, 90);
isTaxi[GetPlayerVehicleID(playerid)]==true;
}
return 1;
}

stock IsSeatTaken(vehicleid, seatid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
}
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) lastcar[playerid]=GetPlayerVehicleID(playerid);
new vehicleid=GetPlayerVehicleID(playerid);
if(isTaxi[vehicleid] && ((newstate == PLAYER_STATE_PASSENGER && IsSeatTaken(vehicleid,0)) || (newstate == PLAYER_STATE_DRIVER &&IsSeatTaken(vehicleid,1) || IsSeatTaken(vehicleid,2) || IsSeatTaken(vehicleid,3) || IsSeatTaken(vehicleid,4))))
{
DestroyObject(objTaxi[vehicleid]);
objTaxi[vehicleid] = CreateObject(19310,0,0,0,0,0,0);
AttachObjectToVehicle(objTaxi[vehicleid], vehicleid, 0, -0.5, 0.94, 0, 0, 90);
}
if(isTaxi[lastcar[playerid]] && oldstate == PLAYER_STATE_PASSENGER && (!IsSeatTaken(lastcar[playerid],1) && !IsSeatTaken(lastcar[playerid],2) && !IsSeatTaken(lastcar[playerid],3)))
{
DestroyObject(objTaxi[lastcar[playerid]]);
objTaxi[lastcar[playerid]] = CreateObject(19308,0,0,0,0,0,0);
AttachObjectToVehicle(objTaxi[lastcar[playerid]], lastcar[playerid], 0, -0.5, 0.94, 0, 0, 90);
}
return 1;
}

how fix?
Reply
#2

any1?
Reply
#3

This should work.

pawn Код:
#include <a_samp>
#include <zcmd>
#include <streamer>

new lastcar[MAX_PLAYERS];
new objTaxi[MAX_VEHICLES];
new isTaxi[MAX_VEHICLES];

public OnFilterScriptInit()
{
    print("Taxi Filterscript Loaded");
    return 1;
}

public OnFilterScriptExit()
{
    print("Taxi Filterscript Unloaded");
    return 1;
}

CMD:maketaxi(playerid, params[])
{
    // if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1,"Error: You aren't in a premier.");
    // if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 426) return SendClientMessage(playerid, -1,"Error: You aren't in a premier.");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You must be the driver of the vehicle.");
    new vehicle = GetPlayerVehicleID(playerid);
    if(isTaxi[vehicle])
    {
        DestroyObject(objTaxi[vehicle]);
        isTaxi[vehicle] = false;
    }
    else if(!isTaxi[vehicle])
    {
        objTaxi[vehicle] = CreateObject(19308,0,0,0,0,0,0);
        AttachObjectToVehicle(objTaxi[vehicle], vehicle, 0, -0.5, 0.94, 0, 0, 90);
        isTaxi[vehicle] = true;
    }
    return 1;
}

stock IsSeatTaken(vehicleid, seatid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerVehicleID(i) == vehicleid && GetPlayerVehicleSeat(i) == seatid) return 1;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) lastcar[playerid] = GetPlayerVehicleID(playerid);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(isTaxi[vehicleid] && ((newstate == PLAYER_STATE_PASSENGER && IsSeatTaken(vehicleid,0)) || (newstate == PLAYER_STATE_DRIVER &&IsSeatTaken(vehicleid,1) || IsSeatTaken(vehicleid,2) || IsSeatTaken(vehicleid,3) || IsSeatTaken(vehicleid,4))))
    {
        DestroyObject(objTaxi[vehicleid]);
        objTaxi[vehicleid] = CreateObject(19310, 0, 0, 0, 0, 0, 0);
        AttachObjectToVehicle(objTaxi[vehicleid], vehicleid, 0, -0.5, 0.94, 0, 0, 90);
    }
    if(isTaxi[lastcar[playerid]] && oldstate == PLAYER_STATE_PASSENGER && (!IsSeatTaken(lastcar[playerid],1) && !IsSeatTaken(lastcar[playerid],2) && !IsSeatTaken(lastcar[playerid],3)))
    {
        DestroyObject(objTaxi[lastcar[playerid]]);
        objTaxi[lastcar[playerid]] = CreateObject(19308,0,0,0,0,0,0);
        AttachObjectToVehicle(objTaxi[lastcar[playerid]], lastcar[playerid], 0, -0.5, 0.94, 0, 0, 90);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)