public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicle = GetPlayerVehicleID(playerid);
if(VehicleInfo[vehicle][vType] == 2)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(PlayerInfo[playerid][pLanguage] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "| This is a Spawn Vehicle | Respawn time: 200 seconds |");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "| Acesta este un vehicul de la Spawn | Timp de respawn: 200 seconds |");
}
}
}
else if(VehicleInfo[vehicle][vType] == 1)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(strcmp(VehicleInfo[vehicle][vOwner],"Noone", true))
{
if(PlayerInfo[playerid][pLanguage] == 1)
{
new string[40 + MAX_PLAYER_NAME];
format(string, sizeof(string), "| This vehicle is owned by %s |", VehicleInfo[vehicle][vOwner]);
SendClientMessage(playerid, COLOR_GREY, string);
}
else
{
new string[40 + MAX_PLAYER_NAME];
format(string, sizeof(string), "| Acest vehicul este detinut de catre %s |", VehicleInfo[vehicle][vOwner]);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
else
{
if(PlayerInfo[playerid][pLanguage] == 1)
{
new string[80];
format(string, sizeof(string),"| This vehicle is for sale, Price: %d COINS |", VehicleInfo[vehicle][vPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
else
{
new string[80];
format(string, sizeof(string),"| Acest vehicul este de vanzare, Pret: %d COINS |", VehicleInfo[vehicle][vPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
else if(VehicleInfo[vehicle][vType] == 3)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(DrivingTest[playerid] == false)
{
SCM(playerid, COLOR_GREY, "| This is a Driving School Vehicle and you are not allowed to freely drive it |");
}
}
}
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new fuel_string[5];
PlayerTextDrawShow(playerid, speedo[0][playerid]);
PlayerTextDrawShow(playerid, speedo[1][playerid]);
PlayerTextDrawShow(playerid, speedo[2][playerid]);
PlayerTextDrawShow(playerid, speedo[3][playerid]);
PlayerTextDrawShow(playerid, speedo[4][playerid]);
format(fuel_string, sizeof(fuel_string), "%i", VehicleInfo[vehicle][vFuel]);
PlayerTextDrawSetString(playerid, speedo[7][playerid], fuel_string);
}
else if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT || oldstate == PLAYER_STATE_PASSENGER && newstate == PLAYER_STATE_ONFOOT)
{
PlayerTextDrawHide(playerid, speedo[0][playerid]);
PlayerTextDrawHide(playerid, speedo[1][playerid]);
PlayerTextDrawHide(playerid, speedo[2][playerid]);
PlayerTextDrawHide(playerid, speedo[3][playerid]);
PlayerTextDrawHide(playerid, speedo[4][playerid]);
PlayerTextDrawSetString(playerid, speedo[7][playerid], " ");
}
return 1;
}
First of all your code is too many you lines.
Shorten it by placing if(newstate == PLAYER above the other codes so it would make it short and easy to read. and I can't help you more right now maybe try commenting the vehicle type 3 and check what happens... if it works then there must be a missing bracket you missed.. |
The bug is due to the way the data is loaded, trying to fix that..
|