What the actualll.... OnPlayerStateChange
#1

Right, so I want to respawn a vehicle when exiting or falling off (pizzabike)... and yes it respawns A bike but not the one you're exiting... it you're exiting pizzabike, it respawns pizzabike1... and pizzabik1 respawns pizzabike2. Please, someone tell me what the fuck is wrong with this? o.o it was working earlier so something i've switched around somewhere is obviously conflicting.

PS. Don't tell me to try using OnPlayerExitVehicle as I found out you can't actually use the SetVehicleToRespawn function with that...

Vehicles:
pawn Код:
pizzabike = AddStaticVehicleEx(448,2105.6999500,-1784.6999500,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike1 = AddStaticVehicleEx(448,2107.6999500,-1784.6999500,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike2 = AddStaticVehicleEx(448,2109.8000500,-1784.6999500,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike3 = AddStaticVehicleEx(448,2112.0000000,-1784.5999800,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike4 = AddStaticVehicleEx(448,2114.3000500,-1784.5000000,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike5 = AddStaticVehicleEx(448,2116.6999500,-1784.5000000,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike6 = AddStaticVehicleEx(448,2119.0000000,-1784.5000000,13.1000000,0.0000000,0,1,0); //Pizzaboy
    pizzabike7 = AddStaticVehicleEx(448,2103.3999000,-1784.5999800,13.1000000,0.0000000,0,1,0); //Pizzaboy
Entervehicle
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    if(GetPlayerVehicleID(playerid) == pizzabike || pizzabike1 || pizzabike2 || pizzabike3 || pizzabike4 || pizzabike5 || pizzabike6 || pizzabike7)
    {
        if(JobStatus[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "You don't work for the pizza place!"); //change
        }
    }
    return 1;
}
StateChange
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(pizzabike || pizzabike1 || pizzabike2 || pizzabike3 || pizzabike4 || pizzabike5 || pizzabike6 || pizzabike7)
        {
            if(JobStatus[playerid] == 0)
            {
                RemovePlayerFromVehicle(playerid);
            }
            if(JobStatus[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "Type /startwork to start earning money!");
                GetVehicleParamsEx(pizzabike, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike1, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike1, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike2, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike2, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike3, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike3, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike4, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike4, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike5, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike5, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike6, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike6, false, lights, alarm, doors, bonnet, boot, objective);
                GetVehicleParamsEx(pizzabike7, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(pizzabike7, false, lights, alarm, doors, bonnet, boot, objective);
               
            }
        }
    }
    if(oldstate == PLAYER_STATE_DRIVER && pizzabike)
    {
        SetVehicleToRespawn(pizzabike);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike1)
    {
        SetVehicleToRespawn(pizzabike1);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }/*
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike2)
    {
        SetVehicleToRespawn(pizzabike2);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike3)
    {
        SetVehicleToRespawn(pizzabike3);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike4)
    {
        SetVehicleToRespawn(pizzabike4);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike5)
    {
        SetVehicleToRespawn(pizzabike5);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike6)
    {
        SetVehicleToRespawn(pizzabike6);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }
    else if(oldstate == PLAYER_STATE_DRIVER && pizzabike7)
    {
        SetVehicleToRespawn(pizzabike7);
        DestroyDynamicCP(PizzaCP1[playerid]);
        DestroyDynamicCP(PizzaPlace[playerid]);
        SendClientMessage(playerid, COLOR_GREY, "You left your vehicle, it was respawned and if you were on a mission, it was cancelled!"); //change
        SendClientMessage(playerid, COLOR_GREY, "Return to the Pizza Stack to get a new job!"); //change
    }*/

    return 1;
}
Reply
#2

&& pizzabike? Why aren't you mentioning that this is a vehicle ID.

pawn Код:
if(oldstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == pizzabike)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)