SA-MP Forums Archive
ID 0 Teleported to Blueberry when others disconnect ? - 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: ID 0 Teleported to Blueberry when others disconnect ? (/showthread.php?tid=407703)



ID 0 Teleported to Blueberry when others disconnect ? - RobertK - 15.01.2013

Hey. I'm having a bit of trouble with my script. In fact, it's the first problem that I just couldn't find a solution to.
Anyway, the bug is ID 0 will always teleport to either blueberry fields (0.00, 0.00, 0.00) or a blank area (video).

Here's a demonstration.
[ame]http://www.youtube.com/watch?v=xgfQ7hf6toI[/ame]

I can't for the life of me find the error.

I'm willing to post any part of the script, but I can't possibly post the entire thing- it's way too many lines.
Let me know if you need to see a section and if so, which one.
A solution would be MUCH appreciated.

Also tried updating sscanf2 to the most recent one. No fix, however.


Re: ID 0 Teleported to Blueberry when others disconnect ? - CoaPsyFactor - 15.01.2013

show us code of function OnPlayerDisconnect


Re: ID 0 Teleported to Blueberry when others disconnect ? - LarzI - 15.01.2013

You can post the entire thing on pastebin.com.

If not, show us OnPlayerDisconnect - there has to be something there.


Re: ID 0 Teleported to Blueberry when others disconnect ? - CoaPsyFactor - 15.01.2013

you probably put SetPlayerPos(0, x, y, z) instead of setplayerpos(playerid, x, y, z)

and reason why that is blank area its interior id if it put you on coord 0,0,0 you need to be in int 0 to see anything, or maybe it doesn't change your pos but change your interior.


Re: ID 0 Teleported to Blueberry when others disconnect ? - SwisherSweet - 15.01.2013

Give use OnPlayerDissconnect.!!!


Re: ID 0 Teleported to Blueberry when others disconnect ? - RobertK - 15.01.2013

OnPlayerDisconnect isn't too large- only about 100 lines considering how I don't have anything fancy like a hitman or advisor system.

I don't have a SetPlayerPos in there, believe it or not.

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
PlayersConnected--;
    if(
GetPVarInt(playerid"SpeedGun") == 1GivePlayerValidWeapon(playeridGetPVarInt(playerid"RadarGunPrevious"), 60000);
    if(
GetPVarInt(playerid"HospitalSpawning") > 0)
    {
        
PlayerInformation[playerid][HospitalSpawning] = 1;
    }
    if(
control[playerid] == 1)
    {
        
control[playerid] = 0;
        
KillTimer(ControlTimer[playerid]);
    }
    new 
string[128];
    switch (
reason)
    {
            case 
0:
           {
               
format(stringsizeof(string), "%s has timed out from the server."GetPlayerNameEx(playerid));
               
ProxDetector(30.0playeridstringCOLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
           }
           case 
1:
           {
               
format(stringsizeof(string), "%s has left the server."GetPlayerNameEx(playerid));
               
ProxDetector(30.0playeridstringCOLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
        }
        case 
2:
        {
            
format(stringsizeof(string), "%s was removed from the server."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
           }
    }
    if(
GetPVarInt(playerid"gpsonoff") == 1TextDrawDestroy(GPS[playerid]);
    if(
GetPVarInt(playerid"fuelbar") == 1)
     {
          
DestroyProgressBar(CarFuelBar[playerid]);
        
textdrawscount--;
    }
    
    
gActivePlayers[playerid]--;
    
numplayers--;
    
PlayerUpdateStats(playerid);
    
UnloadPVehicles(playerid);
    
ResetPlayerWeapons(playerid);
    
    if(
PlayerBoxing[playerid] > 0)
    {
        if(
Boxer1 == playerid)
        {
            if(
IsPlayerConnected(Boxer1))
            {
                if(
IsPlayerInRangeOfPoint(PlayerBoxing[Boxer2], 20.0768.94, -70.871001.56))
                {
                    
PlayerBoxing[Boxer2] = 0;
                    
SetPlayerPos(Boxer2768.48, -73.661000.57);
                    
SetPlayerInterior(Boxer27);
                    
GameTextForPlayer(Boxer2"Opponent Disconnected"60001);
                    return 
1;
                }
                
PlayerBoxing[Boxer2] = 0;
                
SetPlayerPos(Boxer2765.8433,3.2924,1000.7186);
                
SetPlayerInterior(Boxer25);
                
GameTextForPlayer(Boxer2"Opponent Disconnected"60001);
            }
        }
        else if(
Boxer2 == playerid)
        {
            if(
IsPlayerConnected(Boxer1))
            {
                if(
IsPlayerInRangeOfPoint(PlayerBoxing[Boxer1],20.0,764.35, -66.481001.56))
                {
                    
PlayerBoxing[Boxer1] = 0;
                    
SetPlayerPos(Boxer1768.48, -73.661000.57);
                    
SetPlayerInterior(Boxer17);
                    
GameTextForPlayer(Boxer1"Opponent Disconnected"50001);
                    return 
1;
                }
                
PlayerBoxing[Boxer1] = 0;
                
SetPlayerPos(Boxer1765.8433,3.2924,1000.7186);
                
SetPlayerInterior(Boxer15);
                
GameTextForPlayer(Boxer1"Opponent Disconnected"50001);
            }
        }
        
BoxerInsideRing 0;
         
RoundStart 0;
    }
    return 
1;




Re: ID 0 Teleported to Blueberry when others disconnect ? - ikbenremco - 15.01.2013

You can try to get tped to there DONT MOVE then /save fail C:/DOCUMENTS/SAMP savedpositions.txt copy the coordinates look for them in your GM?


Re: ID 0 Teleported to Blueberry when others disconnect ? - RobertK - 16.01.2013

Unfortunately, there is no SetPlayerPos(playerid, 0, .. ) in the script =/
Anyone know of another possibly solution?


Re: ID 0 Teleported to Blueberry when others disconnect ? - SwisherSweet - 16.01.2013

if(IsPlayerInRangeOfPoint(PlayerBoxing[Boxer1],20.0,764.35, -66.48, 1001.56))
Something is wrong with those 2 codes...