GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: Gyuri_Boyka - 2013. Június 21. - 18:43:41

Cím: Car Resi
Írta: Gyuri_Boyka - 2013. Június 21. - 18:43:41
helló találtam egy kódot ami mûködik is csak az a baj vele hogy respawolja a pótkocsit is ha valakinek van valami ötlete hogy kéne megoldani hogy ne respawolja a pótkocsit ha fel van akasztva írja meg pls!
 

public VehicleReset()
{
for(new vehicleid=0;vehicleid<MAX_VEHICLES; vehicleid++)
{
if(!IsVehicleOccupied(vehicleid))
{
            if(IsTrailerAttachedToVehicle(vehicleid))
            {
                SetVehicleToRespawn(vehicleid);
   }
}
}
}
stock IsVehicleOccupied ( vehicleid )
{
for ( new i = 0; i < MAX_PLAYERS; i++ )
{
if ( IsPlayerInVehicle ( i, vehicleid ) ) return 1;
}
return 0;
}
Cím: Car Resi
Írta: ZSOLTI99 - 2013. Június 22. - 11:38:28
Próbáld meg ezzel hátha jó
 
#include <a_samp>
new bool:Used[MAX_VEHICLES];
new PVeh[MAX_PLAYERS] = INVALID_VEHICLE_ID;
public OnFilterScriptInit()
{
for(new p; p < GetMaxPlayers(); p++)
{
    if(!IsPlayerConnected(p) || GetPlayerState(p) != PLAYER_STATE_DRIVER) { continue; }
    PVeh[p] = GetPlayerVehicleID(p);
Used[PVeh[p]] = true;
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
    PVeh[playerid] = GetPlayerVehicleID(playerid);
Used[PVeh[playerid]] = true;
}
else if(oldstate == PLAYER_STATE_DRIVER)
{
Used[PVeh[playerid]] = false;
PVeh[playerid] = INVALID_VEHICLE_ID;
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(PVeh[playerid] != INVALID_VEHICLE_ID)
{
    Used[PVeh[playerid]] = false;
PVeh[playerid] = INVALID_VEHICLE_ID;
}
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(IsPlayerAdmin(playerid) && !strcmp(cmdtext,\"/carresi\",true))
{
    for(new v = 1; v < MAX_VEHICLES; v++)
    {
            if(!GetVehicleModel(v) || Used[v]) { continue; }
            SetVehicleToRespawn(v);
    }
    SendClientMessageToAll(0xFF6600FF,\"Jármûvek respawnolva...\");
    return 1;
}
return 0;
}
Cím: Car Resi
Írta: Gyuri_Boyka - 2013. Június 22. - 18:59:46
nem jó  :noexpression: