Attaching object to vehicle
#7

Well... if you're creating an object under OnGameModeInit (Only gets called once...), and destroying it every time a player exits a vehicle (which can be called thousands of times...), don't you think you're going to run into trouble?

So... my question WAS of importance to this issue, thank you very much...
pawn Код:
new objectid2[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    objectid2[playerid] = INVALID_OBJECT_ID;
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    //Stuff here
    new vehicleid =  GetPlayerVehicleID(playerid);
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        objectid2[playerid] = CreateObject(1582, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        AttachObjectToVehicle(objectid2[playerid], vehicleid, 0, -1, 0.5, -1.6, 0.0, 0.0);
    }
    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        DestroyObject(objectid2[playerid]);
        objectid2[playerid] = INVALID_OBJECT_ID;
    }
    //More stuff here...
    return 1;
}
Simple...
Reply


Messages In This Thread
Attaching object to vehicle - by Knekt - 28.02.2014, 06:30
Re: Attaching object to vehicle - by Aerotactics - 28.02.2014, 06:33
Re: Attaching object to vehicle - by Threshold - 28.02.2014, 06:34
Re: Attaching object to vehicle - by Knekt - 28.02.2014, 06:35
Re: Attaching object to vehicle - by Aerotactics - 28.02.2014, 06:38
Re: Attaching object to vehicle - by Knekt - 28.02.2014, 06:41
Re: Attaching object to vehicle - by Threshold - 01.03.2014, 15:00

Forum Jump:


Users browsing this thread: 1 Guest(s)