12.07.2012, 06:54
(
Последний раз редактировалось Jochemd; 12.07.2012 в 09:42.
)
If you'd like to see the whole callback:
Must run crashdetect
Edit: Crashdetect loads fine but does not print any log! I compiled fine with the flag "-d3". It neither works on LVDM.
Also I found out the value of the array changes after the "if(newstate == PLAYER_STATE_DRIVER)" line. What the heck
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid),modelid = GetVehicleModel(vehicleid),string[128];
for(new v = 0; v < MAX_CARSHOPVEHS; v ++)
{
if(vehicleid == CarshopInfo[v][VehicleID])
{
format(string,sizeof(string),"~w~You can buy a ~y~%s ~w~for ~r~$%d~w~. Type ~b~/buyvehicle to ~w~purchase one!",vNames[modelid - 400],CarshopInfo[v][Price]);
SetInfoBoxMessage(playerid,string,5000);
SetPVarInt(playerid,"EngineDisabled",1);
return 1;
}
}
if(modelid != 509 && modelid != 510 && modelid != 481)
{
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleBoxDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleNameDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleSpeedDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleFuelDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleLightsDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleDoorsDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleTrunkDraw]);
TextDrawShowForPlayer(playerid,VehicleInfo[vehicleid][VehicleWindowsDraw]);
if(!VehicleInfo[vehicleid][EngineRunning]) SendClientMessage(playerid,COLOR_WHITE,"The engine is currently {FF0F0F}not running.");
else SendClientMessage(playerid,COLOR_WHITE,"The engine is currently {008000}running.");
SetPVarInt(playerid,"CurrentVehicle",vehicleid);
printf("vehicleid = %d - IsInLicTest = %d",vehicleid,GetPVarInt(playerid,"IsInLicTest"));
printf("LicenseVehicle 0 = %d",LicenseVehicle[0]);
printf("LicenseVehicle 1 = %d",LicenseVehicle[1]);
printf("LicenseVehicle 2 = %d",LicenseVehicle[2]);
if(vehicleid == LicenseVehicle[0] || vehicleid == LicenseVehicle[1] || vehicleid == LicenseVehicle[2])
{
if(GetPVarInt(playerid,"IsInLicTest") == 1)
{
GameTextForPlayer(playerid,"~r~Follow ~y~the ~b~Checkpoints ~g~in order! ~y~Do not ~b~damage ~r~the car!",4000,3);
SetPlayerRaceCheckpoint(playerid,0,150.499099,-139.523223,1.324658,-2004.248291,-57.189411,34.906349,3);
SetPVarInt(playerid,"RaceCheckpoint",1);
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"(( Error: You are not following the driving lessons. ))");
}
}
else if(vehicleid == LicenseVehicle[3] || vehicleid == LicenseVehicle[4])
{
if(GetPVarInt(playerid,"IsInLicTest") == 2)
{
GameTextForPlayer(playerid,"~r~Follow ~y~the ~b~Checkpoints ~g~in order! ~y~Do not ~b~damage ~r~the boat!",4000,3);
SetPlayerRaceCheckpoint(playerid,0,-299.836578,-381.801025,0.110261,-401.291717,-345.250305,0.179414,6);
SetPVarInt(playerid,"RaceCheckpoint",15);
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"(( Error: You are not following the sailing lessons. ))");
return 1;
}
}
else if(vehicleid == LicenseVehicle[5] || vehicleid == LicenseVehicle[6])
{
if(GetPVarInt(playerid,"IsInLicTest") == 3)
{
GameTextForPlayer(playerid,"~r~Follow ~y~the ~b~Checkpoints ~g~in order! ~y~Do not ~b~damage ~r~the truck!",4000,3);
SetPlayerRaceCheckpoint(playerid,0,-228.691650,-296.025085,2.096233,-43.304546,-454.409545,2.319302,3); /* Red County */
SetPVarInt(playerid,"RaceCheckpoint",33);
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"(( Error: You are not following the truck driving lessons. ))");
return 1;
}
}
else if(modelid == 448 || modelid == 574 || modelid == 408) SetInfoBoxMessage(playerid,"Type ~g~/work ~w~to start working.",4000);
}
else if(modelid == 509 || modelid == 510 || modelid == 481)
{
SetVehicleParamsEx(vehicleid,1,0,0,1,0,0,0);
SetPVarInt(playerid,"EngineDisabled",1);
}
if(VehicleInfo[vehicleid][Owned] == 1)
{
if(strcmp(VehicleInfo[vehicleid][Owner],PlayerName(playerid),false))
{
format(string,sizeof(string),"This ~y~%s~w~ is not yours. The cops are able to arrest you now.",vNames[modelid-400]);
SetInfoBoxMessage(playerid,string,5000);
SetVehicleAlarm(vehicleid,100000);
}
else if(!strcmp(VehicleInfo[vehicleid][Owner],PlayerName(playerid),false))
{
format(string,sizeof(string),"You are driving this ~y~%s ~w~as you're the ~r~owner.",vNames[modelid-400]);
SetInfoBoxMessage(playerid,string,5000);
}
}
return 1;
}
else if(newstate == PLAYER_STATE_PASSENGER)
{
new vehicleid = GetPlayerVehicleID(playerid),modelid = GetVehicleModel(vehicleid);
SetPVarInt(playerid,"CurrentVehicle",vehicleid);
if(modelid == 420 || modelid == 438)
{
if(GetPlayerVehicleSeat(playerid) != 0)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(i != playerid)
{
if(GetPlayerVehicleID(playerid) == GetPlayerVehicleID(i))
{
if(GetPlayerVehicleSeat(i) == 0)
{
if(GetPVarInt(i,"OnDuty") == 1)
{
GivePlayerCash(playerid,-GetPVarInt(i,"TaxiFareDriver"));
GivePlayerCash(i,GetPVarInt(i,"TaxiFareDriver"));
SendFormatMessage(playerid,COLOR_WHITE,"You have paid {FF0F0F}$%d {FFFFFF}to the Taxi Driver.",GetPVarInt(i,"TaxiFareDriver"));
SendFormatMessage(i,COLOR_YELLOW," %s has entered your Taxi and paid you $%d.",PlayerName(playerid),GetPVarInt(i,"TaxiFareDriver"));
SetPVarInt(playerid,"CalledTaxi",0);
}
}
}
}
}
}
}
}
return 1;
}
if(oldstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPVarInt(playerid,"CurrentVehicle"),Float:Pos[4],Float:Health;
GetVehicleHealth(vehicleid,Health);
if(VehicleInfo[vehicleid][Owned] == 1)
{
if(VehicleInfo[vehicleid][Locked] == 0 && !strcmp(PlayerName(playerid),VehicleInfo[vehicleid][Owner])) SetInfoBoxMessage(playerid,"~w~Lock your ~y~vehicle ~w~or it can be ~r~stolen!",4000);
GetVehiclePos(vehicleid,Pos[0],Pos[1],Pos[2]);
GetVehicleZAngle(vehicleid,Pos[3]);
mysql_format(1,QueryString,"UPDATE `VehicleInfo` SET `VehiclePosX` = %f,`VehiclePosY` = %f,`VehiclePosZ` = %f,`VehicleAngle` = %f, `VehicleFuel` = %d, `VehicleHealth` = %f WHERE `ID` = %d",Pos[0],Pos[1],Pos[2],Pos[3],VehicleInfo[vehicleid][Fuel],Health,VehicleInfo[vehicleid][FileVehicleID]);
mysql_function_query(1,QueryString,false,"SomeNotExistingCallback","","");
}
SetPVarInt(playerid,"EngineDisabled",0);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleBoxDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleNameDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleSpeedDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleFuelDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleDoorsDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleLightsDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleTrunkDraw]);
TextDrawHideForPlayer(playerid,VehicleInfo[vehicleid][VehicleWindowsDraw]);
SetPVarInt(playerid,"CurrentVehicle",0);
return 1;
}
return 1;
}
Edit: Crashdetect loads fine but does not print any log! I compiled fine with the flag "-d3". It neither works on LVDM.
Also I found out the value of the array changes after the "if(newstate == PLAYER_STATE_DRIVER)" line. What the heck