SA-MP Forums Archive
command crashing the server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: command crashing the server (/showthread.php?tid=307731)



command crashing the server - Riddy - 31.12.2011

pawn Код:
//===============================[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


Re: command crashing the server - Riddy - 31.12.2011

Anyone?


Re: command crashing the server - Dark_Kostas - 31.12.2011

pawn Код:
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 plugin that will help you with your crash.


Re: command crashing the server - Riddy - 31.12.2011

I just tested on localhost, it does not crash, SSCANF is making my server crash on Linux, and I got updated