SA-MP Forums Archive
[Help]/despawnsystemveh - 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: [Help]/despawnsystemveh (/showthread.php?tid=287705)



[Help]/despawnsystemveh - Swizzzy - 04.10.2011

Well, Basically i'm struggling to make this command, This is what i have so far but it despawns ALL the vehicles in the server, And Heres the hard part, Making it despawn all the vehicles that the FS has currently spawned.


If anyone can help, I'll be hugely great-full

Heres the Code
CODE


pawn Код:
COMMAND:despawnallveh(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            new string[64], pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string, sizeof string, "~b~Admin: ~g~%s ~r~has despawned all vehicles", pName);
            GameTextForAll(string, 5000, 5);
            DestroyVehicle(i);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED,"You do not have access to this command");
    }
    return 1;
}



Re: [Help]/despawnsystemveh - Raimis_R - 04.10.2011

pawn Код:
COMMAND:despawnallveh(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            new string[64], pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string, sizeof string, "~b~Admin: ~g~%s ~r~has despawned all vehicles", pName);
            GameTextForAll(string, 5000, 5);
            SetVehicleToRespawn(i);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED,"You do not have access to this command");
    }
    return 1;
}



Re: [Help]/despawnsystemveh - Swizzzy - 04.10.2011

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
pawn Код:
COMMAND:despawnallveh(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            new string[64], pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string, sizeof string, "~b~Admin: ~g~%s ~r~has despawned all vehicles", pName);
            GameTextForAll(string, 5000, 5);
            SetVehicleToRespawn(i);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED,"You do not have access to this command");
    }
    return 1;
}
Thanks for posting the code but it didn't work, It despawns EVERY Vehicle on the server.


Re: [Help]/despawnsystemveh - aRoach - 04.10.2011

Well count how many cars do you have in your GameMode and do THIS :
pawn Код:
CMD:despawnallveh( playerid )
{
    if(IsPlayerAdmin(playerid))
    {
        for(new i = 0; i < NUMBER_OF_VEHICLES; i++)
        {
            new string[64], pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            format(string, sizeof string, "~b~Admin: ~g~%s ~r~has despawned all vehicles", pName);
            GameTextForAll(string, 5000, 5);
            SetVehicleToRespawn(i);
        }
    }
    else SendClientMessage(playerid, COLOR_RED,"You do not have access to this command");

    return 1;
}
You can add a define: #define NUMBER_OF_VEHICLES (Your number of Vehicles)


Re: [Help]/despawnsystemveh - Libra_PL - 04.10.2011

I don't know exactly what are you talking about. Despawning? On your script it's destroying all vehicles and on Raimis' it's respawning all. So, I would do the same like Raimis', so that's why I don't understand you...

Well, if you said on your FS, are there any more cars in GM or other FS'?


Re: [Help]/despawnsystemveh - aRoach - 04.10.2011

Well he want to respawn all the Gamemode's Vehicles( Not the vehicles that are in the FSs )....


Re: [Help]/despawnsystemveh - Libra_PL - 04.10.2011

So, if he want all, Raimis did this correctly. Why did he anwsered then it respawns EVERY vehicle? Every = all


Re: [Help]/despawnsystemveh - Swizzzy - 04.10.2011

Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
So, if he want all, Raimis did this correctly. Why did he anwsered then it respawns EVERY vehicle? Every = all
Both of you are wrong, I want it to DESTROY = DESPAWN all the vehicles in the running FS i've made.

NOT The GameMode Vehicles


Re: [Help]/despawnsystemveh - Libra_PL - 04.10.2011

Well, in your command you've added respawning all vehicle that are here (0-1999). They are also in Gamemode.

I'll help you. Add this on top the FS' script:

Код:
new bool:Vehicle[MAX_VEHICLES];
where Vehicle is an example of vehicle name.

When you are creating a vehicle, add true parameter (for example vehicle spawner, like /car)

Код:
vehicleid = GetPlayerVehicleID(playerid);
Vehicle[vehicleid] = true;
That would make if the bool is true. And, in the despawning system, after the loop add checking, is current vehicle have true parameter

Код:
if(Vehicle[i] == true)



Re: [Help]/despawnsystemveh - Swizzzy - 04.10.2011

Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
Well, in your command you've added respawning all vehicle that are here (0-1999). They are also in Gamemode.

I'll help you. Add this on top the FS' script:

Код:
new bool:Vehicle[MAX_VEHICLES];
where Vehicle is an example of vehicle name.

When you are creating a vehicle, add true parameter (for example vehicle spawner, like /car)

Код:
vehicleid = GetPlayerVehicleID(playerid);
Vehicle[vehicleid] = true;
That would make if the bool is true. And, in the despawning system, after the loop add checking, is current vehicle have true parameter

Код:
if(Vehicle[i] == true)
Sorry but there isn't any respawning system allocated inside my FS, I just need a command that DESPAWNS all the vehicles that the Filterscript has created Not inside the GM