SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/03/2020, 04:04 PM   #1
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Players/cars are randomly disappearing and reappearing a few seconds later

How do I fix this? I assume it's a streamer thing?

It just randomly happens, they disappear then like 2-3 seconds later they reappear. Pretty sure it happens with objects too but not sure.

PHP Code:
    Streamer_TickRate(60);
    
Streamer_VisibleItems(STREAMER_TYPE_OBJECTVISIBLE_ITEMS); 
I already tried updating the streamer plugin to the latest one and it didn't fix it

I can still type to people in /b and /me and all those commands, even when they disappear. It still shows up for them so... Idk what that might mean or if it'll help with diagnosing what the problem is but yeah.

Also here is a screenshot of F5 when it happened once. (their ped slots still show up)


Last edited by Ejected; 07/04/2020 at 09:18 PM.
Ejected is offline   Reply With Quote
Old 05/04/2020, 04:39 PM   #2
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

bump
__________________
Ejected is offline   Reply With Quote
Old 05/04/2020, 04:42 PM   #3
NoteND
Huge Clucker
 
Join Date: May 2016
Posts: 252
Reputation: 5
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Show us how you create vehicles.
NoteND is offline   Reply With Quote
Old 05/04/2020, 04:46 PM   #4
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

It's players too that are disappearing though, not just cars

PHP Code:
forward Car_Load();
public 
Car_Load()
{
    static
        
rows,
        
fields,
        
str[128];

    
cache_get_data(rowsfieldsg_iHandle);

    for (new 
0rows++) if (MAX_DYNAMIC_CARS)
    {
        
CarData[i][carExists] = true;
        
CarData[i][carID] = cache_get_field_int(i"carID");
        
CarData[i][carModel] = cache_get_field_int(i"carModel");
        
CarData[i][carOwner] = cache_get_field_int(i"carOwner");
        
CarData[i][carPos][0] = cache_get_field_float(i"carPosX");
        
CarData[i][carPos][1] = cache_get_field_float(i"carPosY");
        
CarData[i][carPos][2] = cache_get_field_float(i"carPosZ");
        
CarData[i][carPos][3] = cache_get_field_float(i"carPosR");
        
CarData[i][carHP] = cache_get_field_float(i"carHP");
        
CarData[i][carPanelsDmg] = cache_get_field_int(i"carPanels");
        
CarData[i][carDoorsDmg] = cache_get_field_int(i"carDoors");
        
CarData[i][carLightsDmg] = cache_get_field_int(i"carLights");
        
CarData[i][carTiresDmg] = cache_get_field_int(i"carTires");
        
CarData[i][carColor1] = cache_get_field_int(i"carColor1");
        
CarData[i][carColor2] = cache_get_field_int(i"carColor2");
        
CarData[i][carPaintjob] = cache_get_field_int(i"carPaintjob");
        
CarData[i][carLocked] = cache_get_field_int(i"carLocked");
        
CarData[i][carImpounded] = cache_get_field_int(i"carImpounded");
        
CarData[i][carImpoundPrice] = cache_get_field_int(i"carImpoundPrice");
        
CarData[i][carFaction] = cache_get_field_int(i"carFaction");
        
CarData[i][carJob] = cache_get_field_int(i"carJob");
        
CarData[i][carSiren] = cache_get_field_int(i"carSiren");
        
cache_get_field_content(i"carPlate"CarData[i][carPlate], g_iHandle15);

        for (new 
014++)
        {
            if (
5)
            {
                
format(strsizeof(str), "carWeapon%d"1);
                
CarData[i][carWeapons][j] = cache_get_field_int(istr);

                
format(strsizeof(str), "carAmmo%d"1);
                
CarData[i][carAmmo][j] = cache_get_field_int(istr);
            }
            
format(strsizeof(str), "carMod%d"1);
            
CarData[i][carMods][j] = cache_get_field_int(istr);
        }
        if(
isnull(CarData[i][carPlate]) == true)
        {
            
GenPlate(CarData[i][carPlate], 7);
            
Car_Save(i);
        }
        
Car_Spawn(i);
    }
    for (new 
0MAX_DYNAMIC_CARS++) if (CarData[i][carExists]) {
        
format(strsizeof(str), "SELECT * FROM `carstorage` WHERE `ID` = '%d'"CarData[i][carID]);

        
mysql_tquery(g_iHandlestr"OnLoadCarStorage""d"i);
    }
    return 
1;

PHP Code:
stock Car_Spawn(carid)
{
    if (
carid != -&& CarData[carid][carExists])
    {
        if (
IsValidVehicle(CarData[carid][carVehicle]))
            
DestroyVehicle(CarData[carid][carVehicle]);

        if (
CarData[carid][carColor1] == -1)
            
CarData[carid][carColor1] = random(127);

        if (
CarData[carid][carColor2] == -1)
            
CarData[carid][carColor2] = random(127);

        
CarData[carid][carVehicle] = CreateVehicle(CarData[carid][carModel], CarData[carid][carPos][0], CarData[carid][carPos][1], CarData[carid][carPos][2], CarData[carid][carPos][3], CarData[carid][carColor1], CarData[carid][carColor2], (CarData[carid][carOwner] != 0) ? (-1) : (1200000), CarData[carid][carSiren]);
        if (
CarData[carid][carVehicle] != INVALID_VEHICLE_ID)
        {
            if (
CarData[carid][carPaintjob] != -1)
            {
                
ChangeVehiclePaintjob(CarData[carid][carVehicle], CarData[carid][carPaintjob]);
            }
            if (
CarData[carid][carLocked])
            {
                new
                    
enginelightsalarmdoorsbonnetbootobjective;

                
GetVehicleParamsEx(CarData[carid][carVehicle], enginelightsalarmdoorsbonnetbootobjective);
                
SetVehicleParamsEx(CarData[carid][carVehicle], enginelightsalarm1bonnetbootobjective);
            }
            for (new 
014++)
            {
                if (
CarData[carid][carMods][i]) AddVehicleComponent(CarData[carid][carVehicle], CarData[carid][carMods][i]);
            }
            if (
CarData[carid][carHP] > 1.0 && CarData[carid][carOwner] != 0)
            {
                
SetVehicleHealth(CarData[carid][carVehicle], CarData[carid][carHP]);
                
UpdateVehicleDamageStatus(CarData[carid][carVehicle], CarData[carid][carPanelsDmg], CarData[carid][carDoorsDmg], CarData[carid][carLightsDmg], CarData[carid][carTiresDmg]);
            }
            
SetVehicleNumberPlate(CarData[carid][carVehicle], CarData[carid][carPlate]);
               
ResetVehicle(CarData[carid][carVehicle]);
            return 
1;
        }
    }
    return 
0;

__________________
Ejected is offline   Reply With Quote
Old 06/04/2020, 07:55 PM   #5
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Bump, still need help please
__________________
Ejected is offline   Reply With Quote
Old 07/04/2020, 06:46 AM   #6
David (Sabljak)
Huge Clucker
 
Join Date: Nov 2011
Posts: 338
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Do you using somewhere TogglePlayerSpectating, or PlayerSpectatePlayer , if yes can you provide all codes and fucntions with that
David (Sabljak) is online now   Reply With Quote
Old 07/04/2020, 07:44 PM   #7
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Quote:
Originally Posted by David (Sabljak) View Post
Do you using somewhere TogglePlayerSpectating, or PlayerSpectatePlayer , if yes can you provide all codes and fucntions with that
PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if (
IsPlayerNPC(playerid))
        return 
1;

    new 
vehicleid GetPlayerVehicleID(playerid);

    if (
newstate == PLAYER_STATE_WASTED && PlayerData[playerid][pJailTime] < 1)
    {
        for (new 
3439++) {
            
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][i]);
        }
        
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][82]);

        
ShowHungerTextdraw(playerid0);
        
PlayerData[playerid][pHealth] = 100.0;

        
ResetWeapons(playerid);
        
ResetPlayer(playerid);

        
PlayerData[playerid][pKilled] = 1;

        if (!
PlayerData[playerid][pInjured])
        {
            
PlayerData[playerid][pInjured] = 1;

            
PlayerData[playerid][pInterior] = GetPlayerInterior(playerid);
            
PlayerData[playerid][pWorld] = GetPlayerVirtualWorld(playerid);

            
GetPlayerPos(playeridPlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
            
GetPlayerFacingAngle(playeridPlayerData[playerid][pPos][3]);
        }
        else
        {
            
TextDrawHideForPlayer(playeridgServerTextdraws[2]);

            
PlayerData[playerid][pInjured] = 0;
            
PlayerData[playerid][pHospital] = GetClosestHospital(playerid);
        }
        if (
PlayerData[playerid][pCallLine] != INVALID_PLAYER_ID)
        {
            
SendClientMessage(PlayerData[playerid][pCallLine], COLOR_YELLOW"[PHONE]:{FFFFFF} The line went dead...");
            
CancelCall(playerid);
        }
        if (
PlayerData[playerid][pCarryCrate] != -1)
        {
            
Crate_Drop(playerid);
        }
    }
    else if (
oldstate == PLAYER_STATE_DRIVER)
    {
        if (
GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY || GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED)
            return 
RemoveFromVehicle(playerid);

        for (new 
3439++)
            
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][i]);

        
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][82]);
    }
    else if (
newstate == PLAYER_STATE_DRIVER)
    {
        new 
id Car_GetID(vehicleid);

        if (
id != -&& CarData[id][carFaction] > && GetFactionType(playerid) != CarData[id][carFaction]) {
            
RemovePlayerFromVehicle(playerid);

            return 
SendErrorMessage(playerid"You don't have the keys to this vehicle.");
        }
        if (
id != -&& CarData[id][carJob] > && PlayerData[playerid][pJob] != CarData[id][carJob]) {
            
RemovePlayerFromVehicle(playerid);

            return 
SendErrorMessage(playerid"You don't have the keys to this vehicle.");
        }
        if (
PlayerData[playerid][pJob] == JOB_GARBAGE && GetVehicleModel(vehicleid) == 408 && CoreVehicles[vehicleid][vehTrash] > 0)
        {
            new 
pointid = -1;

            if ((
pointid GetClosestJobPoint(playerid7)) != -1)
            {
                
PlayerData[playerid][pCP] = 1;
                
SetPlayerCheckpoint(playeridJobData[pointid][jobPoint][0], JobData[pointid][jobPoint][1], JobData[pointid][jobPoint][2], 2.5);

                
SendServerMessage(playerid"This vehicle is loaded with %d trash bags (marker set to dump)."CoreVehicles[vehicleid][vehTrash]);
            }
        }
        if (
PlayerData[playerid][pJob] == JOB_COURIER && IsLoadableVehicle(vehicleid) && CoreVehicles[vehicleid][vehLoads] > 0)
        {
            if (
PlayerData[playerid][pLoading])
            {
                
DisablePlayerCheckpoint(playerid);
                
PlayerData[playerid][pLoading] = 0;
            }
            static
                
string[64];

            switch (
CoreVehicles[vehicleid][vehLoadType])
            {
                case 
1format(stringsizeof(string), "~b~Loaded:~w~ Retail Supplies~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
2format(stringsizeof(string), "~b~Loaded:~w~ Ammunition~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
3format(stringsizeof(string), "~b~Loaded:~w~ Clothing~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
4format(stringsizeof(string), "~b~Loaded:~w~ Food Supplies~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
5format(stringsizeof(string), "~b~Loaded:~w~ Gasoline~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
6format(stringsizeof(string), "~b~Loaded:~w~ Furniture~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
                case 
7format(stringsizeof(string), "~b~Loaded:~w~ Fishing Supplies~n~~b~Loaded Crates:~w~ %d/6"CoreVehicles[vehicleid][vehLoads]);
            }
            
PlayerTextDrawShow(playeridPlayerData[playerid][pTextdraws][82]);
            
PlayerTextDrawSetString(playeridPlayerData[playerid][pTextdraws][82], string);
        }
        if (
IsVehicleImpounded(vehicleid))
        {
            
RemovePlayerFromVehicle(playerid);
            
SendErrorMessage(playerid"This vehicle is impounded and you can't use it.");
        }
        else if (!
IsEngineVehicle(vehicleid))
        {
            
SetEngineStatus(vehicleidtrue);
        }
        else
        {
            if (!
GetEngineStatus(vehicleid))
            {
                if (
CoreVehicles[vehicleid][vehFuel] < 1)
                    
ShowPlayerFooter(playerid"There is no ~r~fuel~w~ in this vehicle.");

                else if (
ReturnVehicleHealth(vehicleid) <= 300)
                    
ShowPlayerFooter(playerid"This vehicle is ~r~totalled~w~ and needs repairing.");

                  else 
ShowPlayerFooter(playerid"Type ~r~/engine~w~ to start the engine.");
            }
            if (
IsDoorVehicle(vehicleid) && !Inventory_HasItem(playerid"Car License") && !PlayerData[playerid][pDrivingTest])
            {
                   
SendClientMessage(playeridCOLOR_LIGHTRED"[WARNING]:{FFFFFF} You are operating a vehicle without the valid license. You might get in trouble.");
            }
            if (
IsAMotorbike(vehicleid) && !Inventory_HasItem(playerid"Motorbike License") && !PlayerData[playerid][pBikeTest])
            {
                   
SendClientMessage(playeridCOLOR_LIGHTRED"[WARNING]:{FFFFFF} You are operating a motorbike without a valid Motorbike license. You might get in trouble.");
            }
            if (
IsAPlane(vehicleid) && !Inventory_HasItem(playerid"Airplane License") && !PlayerData[playerid][pDrivingTest])
            {
                   
SendClientMessage(playeridCOLOR_LIGHTRED"[WARNING]:{FFFFFF} You are operating an airplane without a valid Plane license. You might get in trouble.");
            }
            if (
IsAHelicopter(vehicleid) && !Inventory_HasItem(playerid"Helicopter License") && !PlayerData[playerid][pDrivingTest])
            {
                   
SendClientMessage(playeridCOLOR_LIGHTRED"[WARNING]:{FFFFFF} You are operating a helicopter without a valid Helicopter license. You might get in trouble.");
            }
        }
        if (
IsSpeedoVehicle(vehicleid) && !PlayerData[playerid][pDisableSpeedo]) for (new 3439++) {
            
PlayerTextDrawShow(playeridPlayerData[playerid][pTextdraws][i]);
        }
        
SetPlayerArmedWeapon(playerid0);
    }
    if ((
oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) && PlayerData[playerid][pPlayRadio])
    {
        
PlayerData[playerid][pPlayRadio] = 0;
        
StopAudioStreamForPlayer(playerid);
    }
    if (
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        if (
PlayerData[playerid][pBoombox] != INVALID_PLAYER_ID)
        {
            
PlayerData[playerid][pBoombox] = INVALID_PLAYER_ID;
            
StopAudioStreamForPlayer(playerid);
        }
        if (
IsEngineVehicle(vehicleid) && CoreVehicles[vehicleid][vehRadio])
        {
            static
                
url[128];

            
strunpack(urlCoreVehicles[vehicleid][vehURL]);

            
StopAudioStreamForPlayer(playerid);
            
PlayAudioStreamForPlayer(playeridurl);

            
PlayerData[playerid][pPlayRadio] = 1;
        }
        foreach (new 
Player) if (PlayerData[i][pSpectator] == playerid) {
             
PlayerSpectateVehicle(iGetPlayerVehicleID(playerid));
        }
        if (
PlayerData[playerid][pInjured] == 1)
        {
            
RemoveFromVehicle(playerid);
        }
    }
    if (
newstate == PLAYER_STATE_PASSENGER)
    {
        switch (
GetPlayerWeapon(playerid))
        {
            case 
222528..33:
                
SetPlayerArmedWeapon(playeridGetPlayerWeapon(playerid));

            default:
                
SetPlayerArmedWeapon(playerid0);
        }
    }
    else if (
oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
        foreach (new 
Player) if (PlayerData[i][pSpectator] == playerid) {
             
PlayerSpectatePlayer(iplayerid);
        }
    }
    if (
newstate == PLAYER_STATE_PASSENGER && IsPlayerInsideTaxi(playerid))
    {
        new 
driverid GetVehicleDriver(GetPlayerVehicleID(playerid));

        
PlayerData[playerid][pTaxiFee] = 5;
        
PlayerData[playerid][pTaxiTime] = 0;
        
PlayerData[playerid][pTaxiPlayer] = driverid;

        
SendServerMessage(driverid"%s has entered your taxi as a passenger."ReturnName(playerid0));
        
SendServerMessage(playerid"You have entered %s's taxi."ReturnName(driverid0));
    }
     if (
oldstate == PLAYER_STATE_PASSENGER && PlayerData[playerid][pTaxiTime] != && PlayerData[playerid][pTaxiPlayer] != INVALID_PLAYER_ID)
    {
        
LeaveTaxi(playeridPlayerData[playerid][pTaxiPlayer]);
    }
    if(
newstate == PLAYER_STATE_PASSENGER)
    {
        if (
GetVehicleModel(vehicleid) == 431 || GetVehicleModel(vehicleid) == 437)
        {
            
SetPlayerPosEx(playerid2022.02732235.24022103.9536);
            
SetPlayerTime(playerid00,00);
            
SetPlayerFacingAngle(playerid0);
            
SetCameraBehindPlayer(playerid);
            
SetPlayerInterior(playerid1);
            
Timer1[playerid] = SetTimerEx("HornA"600001"i"playerid);
            
Timer2[playerid] = SetTimerEx("HornB"605001"i"playerid);
            
Timer3[playerid] = SetTimerEx("STime"600001"i"playerid);
            
IsInBus[playerid] = vehicleid;
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 582)
    {
         
SetPlayerPosEx(playerid1061.719727, -914.996704138.026016);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
Intropic[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
    {
         
SetPlayerPosEx(playerid1892.5037, -8156.80622.4471);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
IsInShml[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
    {
         
SetPlayerPosEx(playerid, -813.1215, -1007.36222525.9072);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
InAmbulance[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 427)
    {
         
SetPlayerPosEx(playerid1384.0615, -2245.80153006.4172);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
InEnforcer[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 508)
    {
         
SetPlayerPosEx(playerid, -1503.16202511.72633207.6506);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
InJourney[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 563)
    {
         
SetPlayerPosEx(playerid, -765.62411596.52373002.6099);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
InRaindance[playerid] = GetPlayerVehicleID(playerid);
    }
    return 
1;


PHP Code:
case THREAD_LOAD_CHARACTER:
        {
            static
                
string[128];

            
cache_get_data(rowsfieldsg_iHandle);

            foreach (new 
Player)
            {
                if (
PlayerData[i][pCharacter] == PlayerData[extraid][pCharacter] && !strcmp(ReturnName(i), PlayerCharacters[extraid][PlayerData[extraid][pCharacter] - 1]) && != extraid)
                   {
                       
ShowCharacterMenu(extraid);
                       
SendErrorMessage(extraid"This character is already logged in.");
                }
            }

            switch (
SetPlayerName(extraidPlayerCharacters[extraid][PlayerData[extraid][pCharacter] - 1]))
            {
                case -
1: {
                    
SendClientMessageEx(extraidCOLOR_LIGHTRED"Notice: Your character's name seems to be in use already.");
                }
                default:
                {
                    if (!
rows) {
                        return 
0;
                    }
                    static
                        
query[128]
                    ;
                    
PlayerData[extraid][pID] = cache_get_field_int(0"ID");
                    
PlayerData[extraid][pCreated] = cache_get_field_int(0"Created");
                    
PlayerData[extraid][pGender] = cache_get_field_int(0"Gender");

                    
cache_get_field_content(0"Birthdate"PlayerData[extraid][pBirthdate], g_iHandle24);
                    
cache_get_field_content(0"Origin"PlayerData[extraid][pOrigin], g_iHandle32);

                    
PlayerData[extraid][pSkin] = cache_get_field_int(0"skin");
                    
PlayerData[extraid][pPos][0] = cache_get_field_float(0"PosX");
                    
PlayerData[extraid][pPos][1] = cache_get_field_float(0"PosY");
                    
PlayerData[extraid][pPos][2] = cache_get_field_float(0"PosZ");
                    
PlayerData[extraid][pPos][3] = cache_get_field_float(0"PosA");
                    
PlayerData[extraid][pHealth] = cache_get_field_float(0"Health");
                    
PlayerData[extraid][pInterior] = cache_get_field_int(0"Interior");
                    
PlayerData[extraid][pWorld] = cache_get_field_int(0"World");
                    
PlayerData[extraid][pHospital] = cache_get_field_int(0"Hospital");
                    
PlayerData[extraid][pHospitalInt] = cache_get_field_int(0"HospitalInt");
                    
PlayerData[extraid][pMoney] = cache_get_field_int(0"Money");
                    
PlayerData[extraid][pBankMoney] = cache_get_field_int(0"BankMoney");
                    
PlayerData[extraid][pOwnsBillboard] = cache_get_field_int(0"OwnsBillboard");
                    
PlayerData[extraid][pSavings] = cache_get_field_int(0"Savings");
                    
PlayerData[extraid][pAdmin] = cache_get_field_int(0"Admin");
                    
PlayerData[extraid][pAdvisor] = cache_get_field_int(0"Advisor");
                    
PlayerData[extraid][pAccent] = cache_get_field_int(0"Accent");
                    
PlayerData[extraid][pJailTime] = cache_get_field_int(0"JailTime");
                    
PlayerData[extraid][pMuted] = cache_get_field_int(0"Muted");
                    
PlayerData[extraid][pHouse] = cache_get_field_int(0"House");
                    
PlayerData[extraid][pBusiness] = cache_get_field_int(0"Business");
                    
PlayerData[extraid][pEntrance] = cache_get_field_int(0"Entrance");
                    
PlayerData[extraid][pPhone] = cache_get_field_int(0"Phone");
                    
PlayerData[extraid][pLottery] = cache_get_field_int(0"Lottery");
                    
PlayerData[extraid][pLottery] = cache_get_field_int(0"LotteryB");
                    
PlayerData[extraid][pHunger] = cache_get_field_int(0"Hunger");
                    
PlayerData[extraid][pThirst] = cache_get_field_int(0"Thirst");
                    
PlayerData[extraid][pPlayingHours] = cache_get_field_int(0"PlayingHours");
                    
PlayerData[extraid][pMinutes] = cache_get_field_int(0"Minutes");
                    
PlayerData[extraid][pArmorStatus] = cache_get_field_float(0"ArmorStatus");
                    
PlayerData[extraid][pJob] = cache_get_field_int(0"Job");
                    
PlayerData[extraid][pFactionID] = cache_get_field_int(0"Faction");
                    
PlayerData[extraid][pFactionRank] = cache_get_field_int(0"FactionRank");
                    
PlayerData[extraid][pFactionDivision] = cache_get_field_int(0"FactionDivision");
                    
PlayerData[extraid][pPrisoned] = cache_get_field_int(0"Prisoned");
                    
PlayerData[extraid][pInjured] = cache_get_field_int(0"Injured");
                    
PlayerData[extraid][pWarrants] = cache_get_field_int(0"Warrants");
                    
PlayerData[extraid][pChannel] = cache_get_field_int(0"Channel");
                    
PlayerData[extraid][pBleeding] = cache_get_field_int(0"Bleeding");
                    
PlayerData[extraid][pAdminHide] = cache_get_field_int(0"AdminHide");
                    
PlayerData[extraid][pWarnings] = cache_get_field_int(0"Warnings");
                    
PlayerData[extraid][pDonator] = cache_get_field_int(0"Donator");
                    
PlayerData[extraid][pFightStyle] = cache_get_field_int(0"FightStyle");
                    
PlayerData[extraid][pMaskID] = cache_get_field_int(0"MaskID");
                    
PlayerData[extraid][pFactionMod] = cache_get_field_int(0"FactionMod");
                    
PlayerData[extraid][pSwatMember] = cache_get_field_int(0"SwatMember");
                    
PlayerData[extraid][pClothes1] = cache_get_field_int(0"Clothes1");
                    
PlayerData[extraid][pClothes2] = cache_get_field_int(0"Clothes2");
                    
PlayerData[extraid][pClothes3] = cache_get_field_int(0"Clothes3");
                    
PlayerData[extraid][pCapacity] = cache_get_field_int(0"Capacity");
                    
PlayerData[extraid][pChannel2] = cache_get_field_int(0"Channel2");
                    
PlayerData[extraid][pChannel3] = cache_get_field_int(0"Channel3");
                    
PlayerData[extraid][pChannel4] = cache_get_field_int(0"Channel4");
                    
PlayerData[extraid][pSpawnPoint] = cache_get_field_int(0"SpawnPoint");
                    
PlayerData[extraid][pCarLicense] = cache_get_field_int(0"CarLicense");
                    
PlayerData[extraid][pTruckLicense] = cache_get_field_int(0"TruckLicense");
                    
PlayerData[extraid][pBikeLicense] = cache_get_field_int(0"MotorBikeLicense");
                    
PlayerData[extraid][pAirLicense] = cache_get_field_int(0"AirplaneLicense");
                    
PlayerData[extraid][pHeliLicense] = cache_get_field_int(0"HelicopterLicense");
                    
PlayerData[extraid][pWeaponLicense] = cache_get_field_int(0"WeaponLicense");
                    
PlayerData[extraid][pToggleChatAnim] = cache_get_field_int(0"ChatAnim");

                    
OnlineOnDatabase(extraid1);

                    
cache_get_field_content(0"Warn1"PlayerData[extraid][pWarn1], g_iHandle32);
                    
cache_get_field_content(0"Warn2"PlayerData[extraid][pWarn2], g_iHandle32);
                    
cache_get_field_content(0"ForumName"PlayerData[extraid][pForumName], g_iHandle32);

                    for (new 
013++) {
                        
format(querysizeof(query), "Gun%d"1);
                        
PlayerData[extraid][pGuns][i] = cache_get_field_int(0query);

                        
format(querysizeof(query), "Ammo%d"1);
                        
PlayerData[extraid][pAmmo][i] = cache_get_field_int(0query);
                    }
                    
PlayerData[extraid][pGlasses] = cache_get_field_int(0"Glasses");
                    
PlayerData[extraid][pHat] = cache_get_field_int(0"Hat");
                    
PlayerData[extraid][pBandana] = cache_get_field_int(0"Bandana");

                    
cache_get_field_content(0"GlassesPos"stringg_iHandle);
                    
sscanf(string"p<|>fffffffff"AccessoryData[extraid][0][0], AccessoryData[extraid][0][1], AccessoryData[extraid][0][2], AccessoryData[extraid][0][3], AccessoryData[extraid][0][4], AccessoryData[extraid][0][5], AccessoryData[extraid][0][6], AccessoryData[extraid][0][7], AccessoryData[extraid][0][8]);

                    
cache_get_field_content(0"HatPos"stringg_iHandle);
                    
sscanf(string"p<|>fffffffff"AccessoryData[extraid][1][0], AccessoryData[extraid][1][1], AccessoryData[extraid][1][2], AccessoryData[extraid][1][3], AccessoryData[extraid][1][4], AccessoryData[extraid][1][5], AccessoryData[extraid][1][6], AccessoryData[extraid][1][7], AccessoryData[extraid][1][8]);

                    
cache_get_field_content(0"BandanaPos"stringg_iHandle);
                    
sscanf(string"p<|>fffffffff"AccessoryData[extraid][2][0], AccessoryData[extraid][2][1], AccessoryData[extraid][2][2], AccessoryData[extraid][2][3], AccessoryData[extraid][2][4], AccessoryData[extraid][2][5], AccessoryData[extraid][2][6], AccessoryData[extraid][2][7], AccessoryData[extraid][2][8]);

                    if (!
PlayerData[extraid][pMaskID])
                        
PlayerData[extraid][pMaskID] = random(90000) + 10000;

                    if (!
PlayerData[extraid][pCapacity])
                        
PlayerData[extraid][pCapacity] = 35;

                    for (new 
081++) {
                        if (
|| (>= 71 && <= 80)) PlayerTextDrawHide(extraidPlayerData[extraid][pTextdraws][i]);
                    }
                    
SendClientMessage(extraidCOLOR_ORANGE"[UPDATES] {FFFFFF}Most Recent Update: {FFA500}April 4th, 2020 (midnight){FFFFFF} | View the changelog on the forums at: www.ccroleplay.com");
                    if (
PlayerData[extraid][pAdmin] > 0)
                    {
                        
SendAdminAction(extraid"You have logged in as an Administrator level: %d."PlayerData[extraid][pAdmin]);
                        if(
PlayerData[extraid][pAdminHide] == 0SendAdminAlert(COLOR_LIGHTRED"[ADMIN] %s %s just logged in."AdminRankName(extraid), ReturnName(extraid0));
                    }
                    if (
PlayerData[extraid][pAdvisor] > 0)
                    {
                        
SendAdminAction(extraid"You have logged in as an Advisor level: %d."PlayerData[extraid][pAdvisor]);
                    }
                    
PlayerData[extraid][pLogged] = 1;

                    
format(querysizeof(query), "SELECT * FROM `inventory` WHERE `ID` = '%d'"PlayerData[extraid][pID]);
                    
mysql_tquery(g_iHandlequery"OnQueryFinished""dd"extraidTHREAD_LOAD_INVENTORY);

                    
format(querysizeof(query), "SELECT * FROM `contacts` WHERE `ID` = '%d'"PlayerData[extraid][pID]);
                    
mysql_tquery(g_iHandlequery"OnQueryFinished""dd"extraidTHREAD_LOAD_CONTACTS);

                    
format(querysizeof(query), "SELECT * FROM `tickets` WHERE `ID` = '%d'"PlayerData[extraid][pID]);
                    
mysql_tquery(g_iHandlequery"OnQueryFinished""dd"extraidTHREAD_LOAD_TICKETS);

                    
format(querysizeof(query), "SELECT * FROM `gps` WHERE `ID` = '%d'"PlayerData[extraid][pID]);
                    
mysql_tquery(g_iHandlequery"OnQueryFinished""dd"extraidTHREAD_LOAD_LOCATIONS);

                    if(
PlayerData[extraid][pOwnsBillboard] == 0)
                    {
                        
PlayerData[extraid][pOwnsBillboard] = -1;
                    }
                    if (
PlayerData[extraid][pFactionID] != -1) {
                        
PlayerData[extraid][pFaction] = GetFactionByID(PlayerData[extraid][pFactionID]);

                        if (
PlayerData[extraid][pFaction] == -1) {
                            
ResetFaction(extraid);
                        }
                    }
                    if (!
PlayerData[extraid][pCreated])
                    {
                        new
                            
str[48];


                        
HideLoginTD(extraid);
                        
format(strsizeof(str), "~r~Name:~w~ %s"ReturnName(extraid));
                        
PlayerTextDrawSetString(extraidPlayerData[extraid][pTextdraws][14], str);

                        for (new 
1123++) {
                            
PlayerTextDrawShow(extraidPlayerData[extraid][pTextdraws][i]);
                        }
                        
PlayerData[extraid][pSkin] = 98;

                        
PlayerData[extraid][pOrigin][0] = '\0';
                        
PlayerData[extraid][pBirthdate][0] = '\0';

                        
SendServerMessage(extraid"You are now required to fill in your ID card.");
                        
SetPlayerInterior(extraid3);

                        
SetPlayerPos(extraid364.958312173.570709990.610534);
                        
SetPlayerCameraPos(extraid364.958312173.5707091010.610534);
                        
SetPlayerCameraLookAt(extraid364.458343173.5760491010.389343);
                    }
                    else
                    {
                        
SetSpawnInfo(extraid0PlayerData[extraid][pSkin], PlayerData[extraid][pPos][0], PlayerData[extraid][pPos][1], PlayerData[extraid][pPos][2], 0.0000000);

                        
TogglePlayerSpectating(extraid0);
                        
TogglePlayerControllable(extraid0);
                        
SetPlayerFightingStyle(extraidPlayerData[extraid][pFightStyle]);

                        
CancelSelectTextDraw(extraid);
                        
SetTimerEx("SpawnTimer"1000false"d"extraid);
                    }
                } 
PHP Code:
CMD:spectate(playeridparams[])
{
    new 
userid;

    if (
PlayerData[playerid][pAdmin] < 1)
        return 
SendErrorMessage(playerid"You don't have permission to use this command.");

    if (!
isnull(params) && !strcmp(params"off"true))
    {
        if (
GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
            return 
SendErrorMessage(playerid"You are not spectating any player.");

        
PlayerSpectatePlayer(playeridINVALID_PLAYER_ID);
        
PlayerSpectateVehicle(playeridINVALID_VEHICLE_ID);

        
SetSpawnInfo(playerid0PlayerData[playerid][pSkin], PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2], PlayerData[playerid][pPos][3], 000000);
        
TogglePlayerSpectating(playeridfalse);

        return 
SendServerMessage(playerid"You are no longer in spectator mode.");
    }
    if (
sscanf(params"u"userid))
        return 
SendSyntaxMessage(playerid"/spectate [playerid/name] - Type \"/spectate off\" to stop spectating.");

    if (
userid == INVALID_PLAYER_ID)
        return 
SendErrorMessage(playerid"You have specified an invalid player.");

    if (
GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
    {
        
GetPlayerPos(playeridPlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
        
GetPlayerFacingAngle(playeridPlayerData[playerid][pPos][3]);

        
PlayerData[playerid][pInterior] = GetPlayerInterior(playerid);
        
PlayerData[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
    }
    
SetPlayerInterior(playeridGetPlayerInterior(userid));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(userid));

    
TogglePlayerSpectating(playerid1);

    if (
IsPlayerInAnyVehicle(userid))
        
PlayerSpectateVehicle(playeridGetPlayerVehicleID(userid));

    else
        
PlayerSpectatePlayer(playeriduserid);

    
SendServerMessage(playerid"You are now spectating %s (ID: %d)."ReturnName(userid0), userid);
    
PlayerData[playerid][pSpectator] = userid;

    return 
1;

PHP Code:
public OnPlayerRequestClass(playeridclassid)
{
    if (
IsPlayerNPC(playerid))
        return 
1;

    if (!
PlayerData[playerid][pAccount] && !PlayerData[playerid][pKicked])
    {
        new
            
time[3];

        
gettime(time[0], time[1], time[2]);
        
SetPlayerTime(playeridtime[0], time[1]);

        
PlayerData[playerid][pAccount] = 1;
        
TogglePlayerSpectating(playerid1);

        
SetPlayerColor(playeridDEFAULT_COLOR);
        
SetTimerEx("AccountCheck"400false"d"playerid); // 400 ms
    
}
    return 
1;

__________________
Ejected is offline   Reply With Quote
Old 07/04/2020, 09:19 PM   #8
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

I edited the main thread a bit too, I added some more info and added a screenshot, it might help. I'm not sure at all :/
__________________
Ejected is offline   Reply With Quote
Old 07/04/2020, 11:00 PM   #9
David (Sabljak)
Huge Clucker
 
Join Date: Nov 2011
Posts: 338
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Can you try to "temporarly" disable every PlayerSpectatePlayer, TogglePlayerSpectating, PlayerSpectateVehicle with "//" before, and try to test again if someone is "respawning"
David (Sabljak) is online now   Reply With Quote
Old 08/04/2020, 04:00 PM   #10
Ejected
Big Clucker
 
Ejected's Avatar
 
Join Date: Jul 2012
Location: United States Discord: ABC#6701
Posts: 184
Reputation: 18
Default Re: Players/cars are randomly disappearing and reappearing a few seconds later

Quote:
Originally Posted by David (Sabljak) View Post
Can you try to "temporarly" disable every PlayerSpectatePlayer, TogglePlayerSpectating, PlayerSpectateVehicle with "//" before, and try to test again if someone is "respawning"
Yes I'll try this and reply in a day or two thanks for the suggestion
__________________
Ejected is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vehicles disappearing after a few seconds KevTheJoker Scripting Help 8 28/01/2019 01:25 AM
CreateDynamicCP randomly disappearing? Dan. Scripting Help 2 16/11/2017 12:14 AM
Objects disappearing and reappearing? iTooTech Scripting Help 1 13/09/2017 04:50 PM
SetPlayerMapIcon is disappearing after 2 seconds Tass007 Scripting Help 2 14/10/2016 09:47 AM
Players, cars and objects disappearing for a few seconds IzadorO Server Support 0 28/05/2016 05:31 PM


All times are GMT. The time now is 08:38 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.