Detecting if trailer is attached or not
#1

Hi,

I am making a respawnall cmd but i need to detect if the player has trailer attached to their truck or not so it won't respawn the attached trailer. Only unused trailer will be respawned. Any help?

pawn Код:
CMD:respawnallveh(playerid, params[])
{
    new Msg[128], AdName[24];

    SendAdminText(playerid, "/respawnallveh", params);

    if (APlayerData[playerid][LoggedIn] == true)
    {
       if (APlayerData[playerid][PlayerLevel] >= 3)
       {
           for(new i=0; i<MAX_VEHICLES; i++)
           {
               if(IsVehicleEmpty(i)) SetVehicleToRespawn(i);
           }
           GetPlayerName(playerid, AdName, sizeof(AdName));
           format(Msg, sizeof(Msg), "** Administrator %s has respawned all the vehicles.", AdName);
           SendClientMessageToAll(ADCOLOR, Msg);
       }
       else
           return 0;
    }
    else
        return 0;
    return 1;
}

stock IsVehicleEmpty(vehicleid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid)) return 0;
    }
    return 1;
}
Reply


Messages In This Thread
Detecting if trailer is attached or not - by iOxide - 26.02.2014, 18:49
Re: Detecting if trailer is attached or not - by Ryan_Undering - 26.02.2014, 21:23

Forum Jump:


Users browsing this thread: 1 Guest(s)