SA-MP Forums Archive
[Ajuda] Respawn Carro - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Respawn Carro (/showthread.php?tid=432821)



Respawn Carro - Tenhos - 24.04.2013

POR FAVOR ALGUEM PODE VER QUAL O ERRO NESSE COMANDO , ELE ESTA RESPAWNANDO TODOS OS CARROS , EU QUERIA QUE FOSSEM SO OS SEM USO ...

pawn Код:
if (strcmp(cmd, "/rv",true) == 0){
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] > 0){
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "{00FF00} %s (%d) respawnou", pname,playerid);
SendClientMessageToAll(tcadm, string);
for(new v; v<MAX_VEHICLES; v++) if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
SendClientMessage(playerid, Verde, "(INFO) Veiculos Respawnados");
proximocarro = 0;
for(new carro = 0; carro < MAX_CARROS; carro++)
{
format(string, sizeof(string), "carro%d.ini", carro);
if(dini_Exists(string)){
new carroid;
DestroyVehicle(dini_Int(string, "Id"));
carroid = AddStaticVehicle(dini_Int(string, "Modelo"), dini_Float(string, "CordX"), dini_Float(string, "CordY"), dini_Float(string, "CordZ"), dini_Float(string, "Angulo"), dini_Int(string, "Cor1"), dini_Int(string, "Cor2"));
dini_IntSet(string, "Id", carroid);
proximocarro++;
}
}
return 1;
}
}
NO FINAL DO GM

pawn Код:
IsVehicleOccupied(vid)
{
for(new i; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(GetPlayerVehicleID(i) == vid) return true;
}
return false;
}



Re: Respawn Carro - PT - 24.04.2013

Quote:
Originally Posted by PT
Посмотреть сообщение
Olб

Tenta usar o comando assim;

pawn Код:
if(strcmp(cmd, "/rv", true) == 0)
{
    new ptname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, ptname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, ptname);
    if(pAdmin[playerid] > 0)
    {
        for(new v = 0; v < MAX_VEHICLES; v++)
        {
            if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
        }
        SendClientMessage(playerid, Verde, "Veнculos desocupados respawnados!");
        format(string, sizeof(string), "O(A) ADM %s (%d) respawnou todos os veнculos desocupados.", ptname, playerid);
        SendClientMessageToAll(tcadm, string);
    }
    return 1;
}
E a stock assim;

pawn Код:
stock IsVehicleOccupied(vid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
            {
                if(GetPlayerVehicleID(i) == vid)
                {
                    return 1;
                }
            }
        }
    }
    return 0;
}

PT
Ja respondi lб


Re: Respawn Carro - Tenhos - 24.04.2013

Vlw , pode dar cloose nesse , eu botei outras pergunta lбa ..