SA-MP Forums Archive
Need help with a /rac command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with a /rac command (/showthread.php?tid=535489)



Need help with a /rac command - ArchLord - 04.09.2014

Hi.I have a /rac command:
pawn Код:
COMMAND:rac(playerid, params[])
{
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/rac", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
        // Check if the player's admin-level is at least 1
    if(APlayerData[playerid][PlayerLevel] >= 4)
    {
        for (new i = 1; i < MAX_VEHICLES; i++)
        {
            if(IsVehicleOccupied(i) == 0)   SetVehicleToRespawn(i);
        }
    }
    return 1;
}
This command working,but respawn my used trailers.How to add to stop respawn used trailers?Thanks for help


Re: Need help with a /rac command - Jack_Leslie - 04.09.2014

pawn Код:
COMMAND:rac(playerid, params[])
{
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/rac", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
        // Check if the player's admin-level is at least 1
    if(APlayerData[playerid][PlayerLevel] >= 4)
    {
        for (new i = 1; i < MAX_VEHICLES; i++)
        {
            if(IsVehicleOccupied(i) == 0 && GetVehcileModel(i) != insert model id of trailer here)   SetVehicleToRespawn(i);
        }
    }
    return 1;
}

??


Re: Need help with a /rac command - ArchLord - 04.09.2014

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
pawn Код:
COMMAND:rac(playerid, params[])
{
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/rac", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
        // Check if the player's admin-level is at least 1
    if(APlayerData[playerid][PlayerLevel] >= 4)
    {
        for (new i = 1; i < MAX_VEHICLES; i++)
        {
            if(IsVehicleOccupied(i) == 0 && GetVehcileModel(i) != insert model id of trailer here)   SetVehicleToRespawn(i);
        }
    }
    return 1;
}

??
This doesn't working,i have a error and this command respawn my occupied cars.


Re: Need help with a /rac command - Team_PRO - 04.09.2014

try this

pawn Код:
CMD:rac(playerid, params[], help)
{
    if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid,red,error);
    new
        string[128];
    for(new car = 0; car<MAX_CARS;car++) {
    VehicleHaveDriver(car);
    SetVehicleToRespawn(car); }
    format(string,sizeof(string),""COL_ORANGE"Admin "COL_WHITE"%s "COL_RED"has respawn all cars.",GetPName(playerid));
    SendClientMessageToAll(-1,string);
    return 1;
}
stock VehicleHaveDriver(car)
{
        foreach(Player, i)
        {
        if(IsPlayerInVehicle(i, car)) return 1;
        }
        return 1;
}
this is from my gamemode


Re: Need help with a /rac command - Jack_Leslie - 04.09.2014

Quote:
Originally Posted by ArchLord
Посмотреть сообщение
This doesn't working,i have a error and this command respawn my occupied cars.
What error?


Re: Need help with a /rac command - TLN - 04.09.2014

Did you compile with this in the command? If you did, you have to edit it...
pawn Код:
insert model id of trailer here