15.08.2018, 19:23
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".
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;
}