SA-MP Forums Archive
How to fix this - 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: How to fix this (/showthread.php?tid=494431)



How to fix this - kurniarocki - 13.02.2014

this is car of Virgo Wilton

but Virgo Wilton not online


i will ask, how to remove car's offline player


Re: How to fix this - Mahde - 13.02.2014

Well this problem i was suffering from :
Код:

public OnPlayerExitVehicle(playerid, vehicleid)
{
    SetTimerEx("DesVeh", 60000, 0, "i", vehicleid);
    return 1;
}

forward DesVeh(vehid);
public DesVeh(vehid)
{
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, vehid)) return 1;
        }
    }
    SetVehicleToRespawn(vehid);
    return 1;
}
_________________
Hosted Tab for 7$ for 1 day , contact me at skype: MahdiAsali
Demo Hosted Tab: 37.142.239.201:8888

xXx Stunt Paradise Awesome

Server IP: Click Here!

Hosted Tab Game-MP for 10 Euro / per month
Hosted Tab + Server host 50 slots + Control Panel for 15 Euro
Skype: MahdiAsali
Ђ10 Euro for Hosted List


Re: How to fix this - kurniarocki - 13.02.2014

anyone


Re: How to fix this - Mahde - 13.02.2014

Quote:
Originally Posted by kurniarocki
Посмотреть сообщение
anyone
You didnt se my post?
_________________
Hosted Tab for 7$ for 1 day , contact me at skype: MahdiAsali
Demo Hosted Tab: 37.142.239.201:8888

xXx Stunt Paradise Awesome

Server IP: Click Here!

Hosted Tab Game-MP for 10 Euro / per month
Hosted Tab + Server host 50 slots + Control Panel for 15 Euro
Skype: MahdiAsali
Ђ10 Euro for Hosted List


Re: How to fix this - CuervO - 13.02.2014

It all depends on the code.

You have to script it under OnPlayerDisconnect to destroy the player's vehicles if he has any.


Re: How to fix this - SniperArmy - 13.02.2014

Quote:
Originally Posted by Mahde
Посмотреть сообщение
You didnt se my post?
_________________
Hosted Tab for 7$ for 1 day , contact me at skype: MahdiAsali
Demo Hosted Tab: 37.142.239.201:8888

xXx Stunt Paradise Awesome

Server IP: Click Here!

Hosted Tab Game-MP for 10 Euro / per month
Hosted Tab + Server host 50 slots + Control Panel for 15 Euro
Skype: MahdiAsali
Ђ10 Euro for Hosted List
Hey Mahdi It's me Dylano. So you needed some help on scripting ?


Re: How to fix this - kurniarocki - 14.02.2014

Quote:
Originally Posted by CuervO
Посмотреть сообщение
It all depends on the code.

You have to script it under OnPlayerDisconnect to destroy the player's vehicles if he has any.
this code OnPlayerDisconnect,, can you editing my code please
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   
    new plname[24];
    GetPlayerName(playerid, plname, sizeof(plname));
    new playersip[24];
    GetPlayerIp(playerid, playersip, sizeof(playersip));
    new string2[128];
    if(PlayerInfo[playerid][pAdminDuty] == 1)
    {
        SafeResetPlayerWeapons(playerid);
    }
    if(Searching[playerid] == 1)
    {
        RemovePlayerMapIcon(playerid, 500 + playerid);
        Searching[playerid] = 0;
    }
    if(Ronned[playerid] >= 1)
    {
        KillTimer(RonnTimer[playerid]);
    }
    if(PlayerCuffed[playerid])
    {
        KillTimer(cufftimer[playerid]);
    }

    if(playerid == beingvoted && reason != 2)
    {
        KillTimer(votetimer1);
        KillTimer(votetimer2);
        format(string2,sizeof(string2),"[VOTATION]: %s (%d) has logged out, votation over!",plname,playerid);
        SendClientMessageToAll(TEAM_GROVE_COLOR,string2);
        votetimer1 = SetTimer("ResetVotation",300000,false);
    }
    if(PlayerCuffed[playerid] > 0)
    {
        KillTimer(cufftimer[playerid]);
    }

    if(Tazer[playerid] == 1) { SafeGivePlayerWeapon(playerid, 24, PreTazerAmmo[playerid]); }
    gActivePlayers[playerid]--;
    numplayers--;
    RemovePlayerMapIcon(playerid, 37 + playerid);
    TextDrawDestroy(Textdraw64[playerid]);
    TextDrawDestroy(Textdraw54[playerid]);
    TextDrawDestroy(Textdraw53[playerid]);
    TextDrawDestroy(Textdraw52[playerid]);
    TextDrawDestroy(Textdraw49[playerid]);
    TextDrawDestroy(Textdraw42[playerid]);
    TextDrawDestroy(Textdraw41[playerid]);
    TextDrawDestroy(Textdraw40[playerid]);
    TextDrawDestroy(Textdraw39[playerid]);
    TextDrawDestroy(Textdraw1[playerid]);
    KillTimer(TrainTimer[playerid]);
    KillTimer(MoneyTimer[playerid]);
    if(IsPlayerInEVehicle[playerid] != 9999)
    {
        new i = IsPlayerInEVehicle[playerid];
        Seats[i] --;
    }
    new string[24];
    new d,m,y,h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    format(string, sizeof(string), "%d/%d/%d at %d:%d:%d",d,m,y,h,mi,s);
    strmid(PlayerInfo[playerid][pLastSeen], string, 0, strlen(string), 255);
    {
        strmid(PlayerInfo[playerid][pWhyLeft], "Kicked/Banned", 0, strlen("Kicked/Banned"), 255);
    }
    SaveGuns(playerid);
    OnPlayerUpdateEx(playerid);
    if(OfficerCourseStep[playerid] != 255)
    {
        SafeGivePlayerMoney(playerid, -2500);
    }
    if(OnOfficerTest[playerid] != 0)
    {
        SafeGivePlayerMoney(playerid, -5000);
    }
    if(ServerRestarted == 0)
    {
        UpdatePlayerPosition(playerid)
    }
    KillTimer(ChangeNameTimer);
    OnPlayerUpdateEx(playerid);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(TaxiAccepted[i] < 999)
            {
                if(TaxiAccepted[i] == playerid)
                {
                    TaxiAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1);
                    TaxiCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(BusAccepted[i] < 999)
            {
                if(BusAccepted[i] == playerid)
                {
                    BusAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~Bus Caller~n~~r~Left the game", 5000, 1);
                    BusCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
        }
    }
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        admins --;
        if(AFK[playerid] == 1)
        {
            afkadmins --;
        }
    }
    KillTimer(DildoTimerReset);
    /*if(GettingCK[playerid] < 999)
    {
        if(IsPlayerConnected(GettingCK[playerid]))
        {
            SendClientMessage(GettingCK[playerid], COLOR_YELLOW, "Your Character Kill has left the server, try again later.");
            OnCK[GettingCK[playerid]] = 999;
        }
    }*/

    if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
    {
        if(IsPlayerConnected(TransportDriver[playerid]))
        {
            new string5[64];
            TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
            TransportTime[TransportDriver[playerid]] = 0;
            TransportCost[TransportDriver[playerid]] = 0;
            format(string5, sizeof(string5), "~w~Passenger left~n~~g~Earned $%d",TransportCost[playerid]);
            GameTextForPlayer(TransportDriver[playerid], string5, 5000, 1);
        }
    }
    if(GotHit[playerid] > 0)
    {
        if(GetChased[playerid] < 999)
        {
            if(IsPlayerConnected(GetChased[playerid]))
            {
                SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Your Hit has left the server.");
                GoChase[GetChased[playerid]] = 999;
            }
        }
    }
    if(PlayersChannel[playerid] < 999)
    {
        IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
    }
    if(HireCar[playerid] != 299)
    {
        gLastDriver[HireCar[playerid]] = 300;
        gCarLock[HireCar[playerid]] = 0;
        UnLockCar(HireCar[playerid]);
        if(reason != 0)
        {
            SetVehicleToRespawn(HireCar[playerid]);
        }
    }
    if(GangCar[playerid] != 512)
    {
        gLastDriver[GangCar[playerid]] = 520;
        gCarLock[GangCar[playerid]] = 0;
        UnLockCar(GangCar[playerid]);
    }
    if (gLastCar[playerid] > 0)
    {
        gLastDriver[gLastCar[playerid]] = 300;
        if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
        {
            gCarLock[gLastCar[playerid]] = 0;
            UnLockCar(gLastCar[playerid]);
        }
    }
    if(PlayerBoxing[playerid] > 0)
    {
        if(Boxer1 == playerid)
        {
            if(IsPlayerConnected(Boxer2))
            {
                PlayerBoxing[Boxer2] = 0;
                SafeSetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
                SafeSetPlayerInterior(Boxer2, 5);
                GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
            }
        }
        else if(Boxer2 == playerid)
        {
            if(IsPlayerConnected(Boxer1))
            {
                PlayerBoxing[Boxer1] = 0;
                SafeSetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
                SafeSetPlayerInterior(Boxer1, 5);
                GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
            }
        }
        InRing = 0;
        RoundStarted = 0;
        Boxer1 = 255;
        Boxer2 = 255;
        TBoxer = 255;
    }
    if(TransportDuty[playerid] == 1)
    {
        TaxiDrivers -= 1;
    }
    else if(TransportDuty[playerid] == 2)
    {
        BusDrivers -= 1;
    }
/*  if(PlayerInfo[playerid][pJob] == 11)
    {
        if(JobDuty[playerid] == 1) { Medics -= 1; }
    }*/

    else if(PlayerInfo[playerid][pJob] == 7)
    {
        if(JobDuty[playerid] == 1) { Mechanics -= 1; }
    }
    else if(PlayerInfo[playerid][pJob] == 17)
    {
        if(JobDuty[playerid] == 1) { PizzaBoys -= 1; }
    }
    if (PlayerInfo[playerid][pRoadblock] != 0)
    {
        RemoveRoadblock(playerid);
    }
    BusrouteEast[playerid][0] = 0;
    BusrouteWest[playerid][0] = 0;
}



Re: How to fix this - kurniarocki - 14.02.2014

CuervO help me


Re: How to fix this - kurniarocki - 14.02.2014

CuervO please help mee


Re: How to fix this - CuervO - 14.02.2014

This is not a script request section -- this is a Scripting help one. I've already helped by telling what you need to do.

You need to despawn the vehicles at OnPlayerDisconnect if the player who disconnects owns any vehicle. I've got no way to know what variables are the vehicles stored in at.

You'd most probably need a loop if the players can own multiple vehicles.