PDA

View Full Version : command crashing the server


Riddy
31/12/2011, 09:54 PM
//===============================[DMV System]=================================================

if(strcmp(cmd, "/licenseexam", true) == 0) // By Lilcuete

{
if(IsPlayerConnected(playerid))

{
if(DriverTest[playerid] > 0)

{
SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR:You are already on your Driving Test !");
return 1;
}

new newcar = GetPlayerVehicleID(playerid);
if(newcar >= 131 && newcar <= 134)
{
if(PlayerInfo[playerid][pDrivLic] == 0)
{
if(GetPlayerMoney(playerid) >= 500) {
DriverTest[playerid] = 1;
TogglePlayerControllable(playerid, true);
SendClientMessage(playerid,COLOR_LIGHTRED,"_______________Main Driving rules:______________");
SendClientMessage(playerid,COLOR_LIGHTRED,"1) Drive on the right side of the road");
SendClientMessage(playerid,COLOR_LIGHTRED,"2) Don't drive too fast");
SendClientMessage(playerid,COLOR_LIGHTRED,"3) Respect the other drivers on the road");
SendClientMessage(playerid,COLOR_WHITE,"Now enter checkpoint and arrive to last one to in time to complete");
SendClientMessage(playerid,COLOR_WHITE,"Don't go too fast,on streets you may get in trouble if you do.");
SetPlayerCheckpoint(playerid,1244.7015,-1572.9912,12.9179,5.0);
CheckP[playerid] = 0;
//GivePlayerPCash(playerid,-5000);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_DRIVETEST;

}
else
{
SendClientMessage(playerid,COLOR_GREY," You already have a Driving License or don't have 5000$ !");
}

}

}

}
return 1;

}



The DMV Command is crashing the server, Help

Riddy
31/12/2011, 10:07 PM
Anyone?

Dark_Kostas
31/12/2011, 10:12 PM
if(strcmp(cmd, "/licenseexam", true) == 0) // By Lilcuete
{
if(DriverTest[playerid] > 0) return SendClientMessage(playerid,COLOR_LIGHTRED, "ERROR:You are already on your Driving Test !");

new newcar = GetPlayerVehicleID(playerid);
if(newcar >= 131 && newcar <= 134)
{
if(PlayerInfo[playerid][pDrivLic] == 0) return SendClientMessage(playerid,COLOR_GREY," You already have a Driving License !");
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid,COLOR_GREY," You don't have 5000$ !");

DriverTest[playerid] = 1;
TogglePlayerControllable(playerid, true);
SendClientMessage(playerid,COLOR_LIGHTRED,"_______________Main Driving rules:______________");
SendClientMessage(playerid,COLOR_LIGHTRED,"1) Drive on the right side of the road");
SendClientMessage(playerid,COLOR_LIGHTRED,"2) Don't drive too fast");
SendClientMessage(playerid,COLOR_LIGHTRED,"3) Respect the other drivers on the road");
SendClientMessage(playerid,COLOR_WHITE,"Now enter checkpoint and arrive to last one to in time to complete");
SendClientMessage(playerid,COLOR_WHITE,"Don't go too fast,on streets you may get in trouble if you do.");
SetPlayerCheckpoint(playerid,1244.7015,-1572.9912,12.9179,5.0);
CheckP[playerid] = 0;
//GivePlayerPCash(playerid,-5000);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_DRIVETEST;
}
return 1;
}

Try this one and don't bump your topic so fast. Also it will be better that if it still crashes, to provide us some more info like in which part does the code crash. You can finally take a look to THIS (http://forum.sa-mp.com/showthread.php?t=262796) plugin that will help you with your crash.

Riddy
31/12/2011, 10:26 PM
I just tested on localhost, it does not crash, SSCANF is making my server crash on Linux, and I got updated