Respawning Vehs
#1

is there a way to respawn vehicles that are only in Gamemode not in other Filterscripts ?
Reply
#2

You mean respawning all the vehicles which are created in gamemode and not respawning the one in filterscript?

Well. I don't think it's possible. I can be wrong of course. But it's possible to respawn non unoccupied vehicles.
Reply
#3

PHP код:
CMD:respawncars(playerid,params[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][Level] >= 10 || IsPlayerAdmin(playerid))
    {
        
SendClientMessage(playeridgreen"|- Your have Successfully Respawned all Vehicles! -|");
        for(new 
v=0v<MAX_VEHICLESv++)
        {
            if(!
IsVehicleOccupied(v))
            {
                
SetVehicleToRespawn(v);
            }
        }
        return 
1;
    }
    else return 
SendClientMessage(playeridCOLOR_RED"You need to be admin level 10 to use this cmd!");

Next add this
PHP код:
stock IsVehicleOccupied(vehicleid)
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 
0;

Reply
#4

I tried both
Код:
dcmd_respawnvehs(playerid,params[])
{
    #pragma unused params
    #pragma unused playerid
    for(new i=0;i<MAX_VEHICLES;i++)
    {
     	if(!VehicleOccupied(i))
	{
       		SetVehicleToRespawn(i);
       	}
    }
    SendClientMessageToAll(COLOR_ADMIN, "Administrator has respawned all unoccupied vehicles.");
    return 1;
}
and this
Код:
dcmd_respawnvehs(playerid,params[])
{
    #pragma unused params
    #pragma unused playerid
    for(new i = GetVehiclePoolSize(); i > 0; i--)
    {
	    SetVehicleToRespawn(i);
    }
	SendClientMessageToAll(COLOR_ADMIN, "Administrator has respawned all unoccupied vehicles.");
	return 1;
}
but both respawned all vehs Gamemode's one and Filterscript's also
Reply
#5

Quote:
Originally Posted by zamaleksc
Посмотреть сообщение
I tried both
Код:
dcmd_respawnvehs(playerid,params[])
{
    #pragma unused params
    #pragma unused playerid
    for(new i=0;i<MAX_VEHICLES;i++)
    {
     	if(!VehicleOccupied(i))
	{
       		SetVehicleToRespawn(i);
       	}
    }
    SendClientMessageToAll(COLOR_ADMIN, "Administrator has respawned all unoccupied vehicles.");
    return 1;
}
and this
Код:
dcmd_respawnvehs(playerid,params[])
{
    #pragma unused params
    #pragma unused playerid
    for(new i = GetVehiclePoolSize(); i > 0; i--)
    {
	    SetVehicleToRespawn(i);
    }
	SendClientMessageToAll(COLOR_ADMIN, "Administrator has respawned all unoccupied vehicles.");
	return 1;
}
but both respawned all vehs Gamemode's one and Filterscript's also
What your gamemode ?
Reply
#6

it's mine i created it
Reply
#7

Quote:
Originally Posted by zamaleksc
Посмотреть сообщение
it's mine i created it
Are you using vehicle buyable system like vehicle ownership ?
Reply
#8

Quote:
Originally Posted by Amunra
Посмотреть сообщение
PHP код:
CMD:respawncars(playerid,params[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][Level] >= 10 || IsPlayerAdmin(playerid))
    {
        
SendClientMessage(playeridgreen"|- Your have Successfully Respawned all Vehicles! -|");
        for(new 
v=0v<MAX_VEHICLESv++)
        {
            if(!
IsVehicleOccupied(v))
            {
                
SetVehicleToRespawn(v);
            }
        }
        return 
1;
    }
    else return 
SendClientMessage(playeridCOLOR_RED"You need to be admin level 10 to use this cmd!");

Next add this
PHP код:
stock IsVehicleOccupied(vehicleid)
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 
0;

You're too stupid, or completely dumb.
Did you read what he asked for?
You're simply respawning vehicles which are not occupied, while he wanted to respawn only vehicles created by gamemode not filterscript.
Reply
#9

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
You're too stupid, or completely dumb.
Did you read what he asked for?
You're simply respawning vehicles which are not occupied, while he wanted to respawn only vehicles created by gamemode not filterscript.
Thanks for you criticism,but I only tried it with my knowledge
Reply
#10

Yes it is possible but assign the vehicles to an array or some variable so you can loop thru it.

Ie example. Lets say you are using static vehicle system and that you dont create any new vehicles inside a gamemode

Just an example code

PHP код:
new GameModeCars[10]; //Increase 1 to how many cars you want.
GameModeInit() {
    
GameModeCars[0] = CreateVehicle(.....);
    
GameModeCars[1] = CreateVehicle(.....);
    
GameModeCars[2] = CreateVehicle(.....);
    
GameModeCars[3] = CreateVehicle(.....);
    
GameModeCars[4] = CreateVehicle(.....);
    
GameModeCars[5] = CreateVehicle(.....);
    
GameModeCars[6] = CreateVehicle(.....);
    
GameModeCars[7] = CreateVehicle(.....);
    
GameModeCars[8] = CreateVehicle(.....);
    
GameModeCars[9] = CreateVehicle(.....);
       return 
true;
}
CMD:respawngamemodecars(playerid,params[]) {
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You are not a rcon admin");
    new 
count;
    for(new 
isizeof(GameModeCars); i++) {
        if(
IsValidVehicle(GameModeCars[i])) {
            
SetVehicleToRespawn(GameModeCars[i]);
            
count++;
        }
    }
    
printf("Respawned total of %i cars",count);
    return 
true;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)