[Ajuda]Respawn de veiculos desocupados
#1

bem acho q nem preciso explicar mt ^^
alguem tem um cmd assim?
Reply
#2

Preguiзa de usar search? https://sampforum.blast.hk/showthread.php?tid=284836
Acabaram de criar um tуpico assim ontem '-'
Reply
#3

Para respawnar somente os desocupados, use isso:

pawn Код:
if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
Reply
#4

pawn Код:
stock ResetarCarros()
{
    new string[ 200 ];
    for( new v = 0; v < MAX_VEHICLES; v++ )
    {
        if(!IsVehicleOccupied(v)) return SetVehicleToRespawn(v);
    }
    SendClientMessageToAll(-1, "OS CARROS INUTILIZADOS FORГO RESETADOS.");
    return 1;
}
pawn Код:
stock IsVehicleOccupied(vehicleid)
{
    for( new i = 0; i < MAX_VEHICLES; i++ )
    {
        if(IsPlayerInAnyVehicle(i))
        {
            if(GetPlayerVehicleID(i)==vehicleid)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
    }
    return 1;
}
Reply
#5

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/rc", cmdtext, true))
    {
        SendClientMessageToAll(-1, "Algum administrador resetool todos os veiculos!");
        return 1;
    }
    return 0;
}


stock ResetarCarros() //Creditos: thegarfield
{
    static bool:inVeh;
    for(new i; i < MAX_VEHICLES; i++ )
    {
        inVeh = false;
        for(new j; j < GetMaxPlayers(); j++ )
        {
            if(IsPlayerInVehicle( j, i ))
            inVeh = true;
            break;
        }
        if(!inVeh) SetVehicleToRespawn(i);
   }
}
Reply
#6

Quote:
Originally Posted by [O.z]Caroline
Посмотреть сообщение
pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/rc", cmdtext, true))
    {
        SendClientMessageToAll(-1, "Algum administrador resetool todos os veiculos!");
        return 1;
    }
    return 0;
}


stock ResetarCarros() //Creditos: thegarfield
{
    static bool:inVeh;
    for(new i; i < MAX_VEHICLES; i++ )
    {
        inVeh = false;
        for(new j; j < GetMaxPlayers(); j++ )
        {
            if(IsPlayerInVehicle( j, i ))
            inVeh = true;
            break;
        }
        if(!inVeh) SetVehicleToRespawn(i);
   }
}
Carol este seu comando nгo respawna em hmm
Reply
#7

Quote:
Originally Posted by Willian_Luigi
Посмотреть сообщение
Carol este seu comando nгo respawna em hmm
ah sim, nгo tinha visto:
pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/rc", cmdtext, true))
    {
        SendClientMessageToAll(-1, "Algum administrador resetool todos os veiculos!");
        ResetarCarros();
        return 1;
    }
    return 0;
}


stock ResetarCarros() //Creditos: thegarfield
{
    static bool:inVeh;
    for(new i; i < MAX_VEHICLES; i++ )
    {
        inVeh = false;
        for(new j; j < GetMaxPlayers(); j++ )
        {
            if(IsPlayerInVehicle( j, i ))
            inVeh = true;
            break;
        }
        if(!inVeh) SetVehicleToRespawn(i);
   }
}
Reply
#8

#EDIT
TУPICO ERRADO :S
Reply
#9

Код:
		if(strcmp(cmd, "/resetarcarros", true) == 0 || strcmp(cmd, "/rc", true) == 0) // by Ellis
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] < 3)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo esta autorizado a usar este comando.");
			    return 1;
			}
			new bool:unwanted[CAR_AMOUNT];
			for(new player=0; player<MAX_PLAYERS; player++)
     		{
            	if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
     		}
			for(new car = 1; car <= 268; car++)
			{
				if(!unwanted[car]) SetVehicleToRespawn(car);
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "|ADMIN| %s resetou os carros inutilizados.", sendername);
			BroadCast(COLOR_WHITE,string);
		}
		return 1;
	}
Reply
#10

tenta:
http://forum.sa-mp.com/showpost.php?...97&postcount=5
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)