SA-MP Forums Archive
please help me with my gamemode - 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: please help me with my gamemode (/showthread.php?tid=546317)



please help me with my gamemode - JaysonJee - 14.11.2014

Okay i been trying to fix this for week's but i just fail & fail , iam a newbie scripter and know i need your help. So whenever someone loads my server they would have to enter their password and click register and they would run through a tutorial, however what happens is when they click register it would just spawn them under the map in blueberry and they would just crash. so my crash detect, detects this error.

for more info when the player is done with the tutorial they would spawn in unity station however that never happens and they wont even get past the register button, when they click it it would just show them under blueberry farm for 2 secs and it would just crash


THIS IS WHAT CRASH DETECT'S when ever the player crashes
NOTE: i updated all plugins + includes + i recompiled it + no error's with gamemode when compiled

PHP код:
[19:42:15Incoming connection86.25.160.28:55960
[19:42:15] [joinJason_Ray has joined the server (0:86.25.160.28)
[
19:42:25Jason_Ray has logged in.
[
19:42:25]  Loading Jason_Ray's vehicles.
[19:42:25] [debug] Run time error 4: "Array index out of bounds"
[19:42:25] [debug]  Accessing element at index 999 past array upper bound 500
[19:42:25] [debug] AMX backtrace:
[19:42:25] [debug] #0 000792a0 in public RL_OnPlayerStateChange (0, 1, 8) from drlp.amx
[19:42:25] [debug] #1 native CallLocalFunction () from samp-server.exe
[19:42:25] [debug] #2 00014c18 in public OnPlayerStateChange (0, 1, 8) from drlp.amx
[19:42:43]  Unloading Jason_Ray'
s vehicles.
[
19:42:43] [partJason_Ray has left the server (0:0



Re: please help me with my gamemode - AdHaM612 - 14.11.2014

Open drlp.pwn then Copy and Paste the whole OnPlayerStateChange.


Re: please help me with my gamemode - JaysonJee - 14.11.2014

THIS?

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate != 2NOPTrigger[playerid] = 0;
    if(
IsPlayerNPC(playerid))
    {
        if(
newstate == PLAYER_STATE_SPECTATING)
        {
            
TogglePlayerSpectating(playeridfalse);
        }
        return 
1;
    }
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        
ShowSpeedo(playerid);
    }
    if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        
HideSpeedo(playerid);
    }
    if(
GettingSpectated[playerid] != 999)
    {
        new 
spectator GettingSpectated[playerid];
        if(!
IsPlayerConnected(spectator))
        {
            
GettingSpectated[playerid] = 999;
            
Spectate[spectator] = 999;
        }
        if(
newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
            new 
carid GetPlayerVehicleIDplayerid );
            
PlayerSpectateVehiclespectatorcarid );
            
SetPVarInt(spectator"SpecState"newstate);
        }
        else if(
newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
               
PlayerSpectatePlayerspectatorplayerid );
               
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 508)
    {
        
TogglePlayerControllable(playerid0);
        
GameTextForPlayer(playerid"Objects loading..."40005);
         
SetPVarInt(playerid"LoadingObjects"1);
          
SetTimerEx("SafeLoadObjects"40000"d"playerid);
         
SetPlayerPos(playerid2404.993164, -1512.187500898.142944);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
Injourney[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_ONFOOT)
    {
         if(
Audio_IsClientConnected(playerid))
        {
            
Audio_Stop(playeridstationidp[playerid]);
             
stationidp[playerid] = 0;
        }
        new 
spectator GettingSpectated[playerid];
        if(
PlayerInfo[spectator][pAdmin] >= 2) {
            
// Preventing possible buffer overflows with the arrays
             
TogglePlayerSpectating(spectatortrue);
            
PlayerSpectatePlayerspectatorplayerid );
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPlayerVirtualWorldspectatorGetPlayerVirtualWorldplayerid ) );
        }