HELP PLEASE!
#1

Hello! I have a problem with the derby system created by adri1, the problem is that when you are on foot and you put the command / derby, the vehicle does not appear, and neither are the positions executed, only the texts appear and I am in the same place When I'm in a vehicle and I put / derby, it just works normally, the problem happens when you're standing. I realized that the problem is in "OnPlayerStateChange". Please help.

NOTE: I HAVE NOT TOUCHED ANYTHING OF THE DERBY SYSTEM, THE ERROR WAS PRACTICALLY CREATED "ONLY".

PHP Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
      switch(
PI[playerid][P_GAMEMODE])
    {
        case 
M_DERBY:
        {
            if(
oldstate == PLAYER_STATE_DRIVER) //I think this is the problem
            
{
                if(
PI[playerid][P_STATUS] == STATUS_SPAWNED && PI[playerid][P_DERBY_STATUS] == PD_NORMAL)
                {
                    if(!
IsValidVehicle(PI[playerid][P_DERBY_VEHICLEID]) && PI[playerid][P_DERBY_VEHICLEID] != INVALID_VEHICLE_ID)
                    {
                        if(
IsValidVehicle(PI[playerid][P_DERBY_VEHICLEID]) && PI[playerid][P_DERBY_VEHICLEID] != INVALID_VEHICLE_ID)
                        {
                            
DestroyVehicle(PI[playerid][P_DERBY_VEHICLEID]);
                            
PI[playerid][P_DERBY_VEHICLEID] = INVALID_VEHICLE_ID;
                        }
                        
PI[playerid][P_DERBY_VEHICLEID] = CreateVehicle(DI[MODELID], DERBY_SPAWN_POS[ PI[playerid][P_DERBY_SLOT] ][0], DERBY_SPAWN_POS[ PI[playerid][P_DERBY_SLOT] ][1], DERBY_SPAWN_POS[ PI[playerid][P_DERBY_SLOT] ][2] + 2.0, DERBY_SPAWN_POS[ PI[playerid][P_DERBY_SLOT] ][3], -1, -1, -1, false);
                        
SetVehicleVirtualWorld(PI[playerid][P_DERBY_VEHICLEID], DERBY_VW);
                        
SetVehicleParamsEx(PI[playerid][P_DERBY_VEHICLEID], VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, 1, 0, 0, 0); 
                        
PutPlayerInVehicle(playerid, PI[playerid][P_DERBY_VEHICLEID], 0);
                        return 
1;
                    }
                    
PutPlayerInVehicle(playerid, PI[playerid][P_DERBY_VEHICLEID], 0);
                }
            }
            return 
1;
        }
}
return 
1;
} 
Reply
#2

HELP ME, PLEASE!
Reply
#3

Can you show us derby command?
Reply
#4

Quote:
Originally Posted by RedRex
View Post
Can you show us derby command?
Here it is

PHP Code:
        case ENTER_DERBY:
        {
            
PI[playerid][P_DERBY_VEHICLEID] = INVALID_VEHICLE_ID;
            switch(
DI[STATUS])
            {
                case 
DERBY_CLOSED:
                {
                    if(
TOTAL_DERBYS == 0) return 1;
                    if(
TOTAL_DERBYS_OK == 0) return 1;
                    new 
found, id = DI[MAP_ID];
                    while(!
found)
                    {
                        if(
id >= TOTAL_DERBYS) id = 0;
                        if(
DERBY_FILE_INFO[id][DERBY_FILE_VALID])
                        {
                            
found = true;
                            
DI[MAP_ID] = id;
                            break;
                        }
                        
id ++;
                    }
                    if(!
LoadDerby(DERBY_FILE_INFO[ DI[MAP_ID] ][DERBY_NAME]))
                    {
                        
CloseDerby();
                        return 
1;
                    }
                    
DI[STATUS] = DERBY_WAIT;
                    
DI[PLAYERS] = 0;
                    
DI[COUNTDOWN_COUNTER] = 11;
                    
KillTimer(DI[COUNTDOWN_TIMER]); 
                    
DI[COUNTDOWN_TIMER] = SetTimer("DerbyCountdown", 900, true);
                    
PI[playerid][PR_DERBY_SLOT] = GetDerbyVehicleSlot();
                    if(
PI[playerid][PR_DERBY_SLOT] == -1)
                    {
                         
KickPlayerFromDerby(playerid);
                         
EnterPlayerMode(playerid, ENTER_FREEROAM);
                         return 
1;
                     }
                    
DI[PLAYERS] ++;
                    
DERBY_SLOT_USED[ PI[playerid][PR_DERBY_SLOT] ] = true;
                    
PI[playerid][P_GAMEMODE] = M_DERBY;
                    
SetPlayerHealth(playerid, 100.0);
                    
SetPlayerArmour(playerid, 0.0);
                    
SetPlayerInterior(playerid, 0);
                    
ResetPlayerWeapons(playerid);
                    
SetPlayerVirtualWorld(playerid, DERBY_WORLD);
                    if(
IsValidVehicle(PI[playerid][P_DERBY_VEHICLEID]) && PI[playerid][P_DERBY_VEHICLEID] != INVALID_VEHICLE_ID)
                    {
                        
DestroyVehicle(PI[playerid][P_DERBY_VEHICLEID]);
                        
PI[playerid][P_DERBY_VEHICLEID] = INVALID_VEHICLE_ID;
                    }
                    
TogglePlayerControllable(playerid, true);
                    
PI[playerid][P_DERBY_STATUS] = PD_NORMAL;
                    
PI[playerid][P_DERBY_VEHICLEID] = CreateVehicle(DI[MODELID], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][0], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][1], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][2] + 2.0, DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][3], -1, -1, -1, false);
                    
SetVehicleParamsEx(PI[playerid][P_DERBY_VEHICLEID], VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, 1, 0, 0, 0);
                    
SetVehicleVirtualWorld(PI[playerid][P_DERBY_VEHICLEID], DERBY_WORLD);
                    
PutPlayerInVehicle(playerid, PI[playerid][P_DERBY_VEHICLEID], 0);
                    
TextDrawShowForPlayer(playerid, TD_DERBY[9]);
                    new 
str[24]; format(str, sizeof(str), "~w~%s", DI[NAME]);
                    
GameTextForPlayer(playerid, str, 3000,1);
                }
                case 
DERBY_WAIT:
                {
                    
PI[playerid][PR_DERBY_SLOT] = GetDerbyVehicleSlot();
                    if(
PI[playerid][PR_DERBY_SLOT] == -1)
                    {
                        
KickPlayerFromDerby(playerid);
                        
EnterPlayerMode(playerid, ENTER_FREEROAM);
                        return 
1;
                    }
                    
DI[PLAYERS] ++;
                    
DERBY_SLOT_USED[ PI[playerid][PR_DERBY_SLOT] ] = true;
                    
PI[playerid][P_GAMEMODE] = M_DERBY;
                    
SetPlayerHealth(playerid, 100.0);
                    
SetPlayerArmour(playerid, 0.0);
                    
SetPlayerInterior(playerid, 0);
                    
ResetPlayerWeapons(playerid);
                    
SetPlayerVirtualWorld(playerid, DERBY_WORLD);
                    if(
IsValidVehicle(PI[playerid][P_DERBY_VEHICLEID]) && PI[playerid][P_DERBY_VEHICLEID] != INVALID_VEHICLE_ID)
                    {
                        
DestroyVehicle(PI[playerid][P_DERBY_VEHICLEID]);
                        
PI[playerid][P_DERBY_VEHICLEID] = INVALID_VEHICLE_ID;
                    }
                    
TogglePlayerControllable(playerid, true);
                    
PI[playerid][P_DERBY_STATUS] = PD_NORMAL;
                    
PI[playerid][P_DERBY_VEHICLEID] = CreateVehicle(DI[MODELID], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][0], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][1], DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][2] + 2.0, DERBY_SPAWN_POS[ PI[playerid][PR_DERBY_SLOT] ][3], -1, -1, -1, false);
                    
SetVehicleParamsEx(PI[playerid][P_DERBY_VEHICLEID], VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, 1, 0, 0, 0);
                    
SetVehicleVirtualWorld(PI[playerid][P_DERBY_VEHICLEID], DERBY_WORLD);
                    
PutPlayerInVehicle(playerid, PI[playerid][P_DERBY_VEHICLEID], 0);
                    
TextDrawShowForPlayer(playerid, TD_DERBY[9]);
                    new 
str[24]; format(str, sizeof(str), "~w~%s", DI[NAME]);
                    
GameTextForPlayer(playerid, str, 3000,1);
                }
                case 
DERBY_RUNNING:
                {
                    
DI[PLAYERS] ++;
                    
SetPlayerVirtualWorld(playerid, DERBY_WORLD);
                    
PI[playerid][P_DERBY_STATUS] = PD_NORMAL;
                    
PI[playerid][P_GAMEMODE] = M_DERBY;
                    
SetPlayerHealth(playerid, 100.0);
                    
SetPlayerArmour(playerid, 0.0);
                    
SetPlayerInterior(playerid, 0);
                    
ResetPlayerWeapons(playerid);
                    
SetPlayerVirtualWorld(playerid, DERBY_WORLD);
                    if(
IsValidVehicle(PI[playerid][P_DERBY_VEHICLEID]) && PI[playerid][P_DERBY_VEHICLEID] != INVALID_VEHICLE_ID)
                    {
                        
DestroyVehicle(PI[playerid][P_DERBY_VEHICLEID]);
                        
PI[playerid][P_DERBY_VEHICLEID] = INVALID_VEHICLE_ID;
                    }
                    
TogglePlayerControllable(playerid, true);
                    
TextDrawShowForPlayer(playerid, TD_DERBY[10]);
                    
TextDrawShowForPlayer(playerid, TD_DERBY[9]);
                    
PI[playerid][P_DERBY_STATUS] = PD_DEAD;
                    for(new 
i = 0, j = GetPlayerPoolSize(); i <= j; i++)
                    {
                        if(
IsPlayerConnected(i))
                        {
                            if(
PI[i][P_GAMEMODE] == M_DERBY)
                            {
                                if(
PI[i][P_DERBY_STATUS] == PD_NORMAL)
                                {
                                    
PI[playerid][PR_DERBY_SPEC] = i;
                                    break;
                                }
                            }
                        }
                    }
                    
TogglePlayerSpectating(playerid, true);
                    
PlayerSpectateVehicle(playerid, PI[ PI[playerid][PR_DERBY_SPEC] ][P_DERBY_VEHICLEID]);
                    
TextDrawSetString(TD_DERBY[9], "~w~Presiona_~g~intro_~w~para cambiar de jugador");
                    return 
1;
                }
            }
            return 
1;
        } 
Reply
#5

You said you have created a Command such as /derby right? If Yes give me the code of command /derby.
Reply
#6

PHP Code:
CMD:derby(playerid, params[])
{
    if(
PI[playerid][P_GAMEMODE] == M_DERBY) return 1;    
    if(
DI[PLAYERS] >= MAX_DERBY_PLAYERS)  
    {
        
SendClientMessage(playerid, -1, "COMPLETE! 20/20.");
        return 
1;
    }
    
ExitPlayerGameMode(playerid);
    
JoinPlayerGameMode(playerid, GAME_DERBY);
    return 
1;
} 
The code that I mentioned before is from: JoinPlayerGameMode
Reply
#7

Any filterscripts that you are running?

Link to the derby system?
Reply
#8

Quote:
Originally Posted by Sew_Sumi
View Post
Any filterscripts that you are running?

Link to the derby system?
Nop.
Reply
#9

I see that the problem is "PutPlayerInVehicle" when I put a timer the function is executed well.

some solution for that?

PHP Code:
SetTimerEx("test", 3000, false, "i", playerid); //In the code
forward test(playerid);
public 
test(playerid)
{
    
PutPlayerInVehicle(playerid, PI[playerid][P_DERBY_VEHICLEID], 0);
    return 
1;
} 
Reply
#10

If you haven't touched anything, I'd make sure by starting again maybe.

Even though there are no reports of an issue in the English release, it could be that simply no-one checked it.


Have you ever had it working?


That's not so much a solution, as simply forcing them in, as the original method still needs looking into as to why it's not working.
Reply
#11

Yes, the before worked normally, even on Saturday I entered the / derby and it was fine. 2 days later when I went back into the / derby, this did not work, I thought I had done something wrong or moved something without meaning to, but no. I even looked for other versions of the game mode (one version was from Friday and the other from the same Saturday). But when I try those versions, the / derby does not work either.

Edit: The weirdest thing is that the "/ vehicle" command uses that function, and it runs normally.
Reply


Forum Jump:


Users browsing this thread: