Pawn crashing
#1

Since i added this the pawn is crashing at compiling

pawn Код:
#define DIALOG_FKONTROLLE 6
pawn Код:
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
case DIALOG_FKONTROLLE:
        {
            if( response )
            {
                if(listitem == 0)
                {
                    if(GetPVarInt(playerid, "Motor") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Motor", 1);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                    else if(GetPVarInt(playerid, "Motor") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Motor", 0);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                }
                if(listitem == 1)
                {
                    if(GetPVarInt(playerid, "Lichter") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Lichter", 1);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                    else if(GetPVarInt(playerid, "Lichter") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Lichter", 0);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                }
                if(listitem == 2)
                {
                    if(GetPVarInt(playerid, "Motorhaube") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
                        SetPVarInt(playerid, "Motorhaube", 1);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                    else if(GetPVarInt(playerid, "Motorhaube") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
                        SetPVarInt(playerid, "Motorhaube", 0);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                }
                if(listitem == 3)
                {
                    if(GetPVarInt(playerid, "Kofferraum") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
                        SetPVarInt(playerid, "Kofferraum", 1);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                    else if(GetPVarInt(playerid, "Kofferraum") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
                        SetPVarInt(playerid, "Kofferraum", 0);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                }
                if(listitem == 4)
                {
                    if(GetPVarInt(playerid, "Alarm") == 0)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Alarm", 1);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                    else if(GetPVarInt(playerid, "Alarm") == 1)
                    {
                        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
                        SetPVarInt(playerid, "Alarm", 0);
                        PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);
                    }
                }
            }
        }
pawn Код:
CMD:fa(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "Fehler: "COL_WHITE"Du musst im Fahrzeug sein um es zu steuern!");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_FKONTROLLE, DIALOG_STYLE_LIST, "Fahrzeug", "Motor (an/aus)\nLichter (an/aus)\nMotorhaube (auf/zu)\nKofferraum (auf/zu)\nAlarm (an/aus)", "Auswдhlen", "Abbrechen");
    }
    return 1;
}
Reply
#2

You cant use "/" on strings, this char is used by the compiler.

@edit actually you can but in the right way.
Reply
#3

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
You cant use "/" on strings, this char is used by the compiler.

@edit actually you can but in the right way.
I tried to remove it from ShowPlayerDialog and still crashing

btw if i put the new variables on top its crashing, if i put it at the dialog response it says undefined
Reply
#4

pawn Код:
case DIALOG_FKONTROLLE:
        {
            if( response )
            {
                new veh = GetPlayerVehicleID(playerid);
                new engine,lights,alarm,doors,bonnet,boot,objective;
                //......your code......
inside switch you can only use case
Reply
#5

Copy-Pasting is bad (because I doubt they speak German in Vietnam ..)! I've seen far too much people that just copy a part of another gamemode, put it at the bottom of their own script and then expect it to work, just like that.

I suggest you go read some wiki articles about functions and callbacks, because you have no idea what you're doing whatsoever.
Reply
#6

Thanks now it works! +r

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
pawn Код:
case DIALOG_FKONTROLLE:
        {
            if( response )
            {
                new veh = GetPlayerVehicleID(playerid);
                new engine,lights,alarm,doors,bonnet,boot,objective;
                //......your code......
inside switch you can only use case
Quote:
Originally Posted by Vince
Посмотреть сообщение
Copy-Pasting is bad! I've seen far too much people that just copy a part of another gamemode, put it at the bottom of their own script and then expect it to work, just like that.

I suggest you go read some wiki articles about functions and callbacks, because you have no idea what you're doing whatsoever.
Actually it was a filterscript and i want to put it in the new gamemode which i started
Reply
#7

I'm having the same problem with a different code.
I've got ZCMD and everything, but when I compile this, PAWN crashes.

And I actually made this using a tutorial, and I know how it works...

command(startengine, playerid, params[])
{
if(GetPlayerState(playerid) == 2) //This here is checking if the player is inside a vehicle as a driver.
{
new vehicle = GetPlayerVehicleID(playerid); //This part here is defining the vehicle ID that the player is currently in.
if(Engine[vehicle] == 0) //This is checking if the engine of the vehicle, is turned off or not.
{
new engine,lights,alarm,doors,bonnet,boot,objective; //This is defining the vehicles current items.
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This is checking the vehicle's engine/lights/alarm/doors/bonnet/boot/objective status.
Engine[vehicle] = 1; //This is setting the global variable that you created at the beginning.
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
}
}
else return SendClientMessage(playerid, GREY, "This vehicles engine is already turned on.");
return 1;
}

command(stopengine, playerid, params[])//This bit is creating the command
{
#pragma unused params
if(GetPlayerState(playerid) == 2) //This bit is checking the players seat
{
new vehicle = GetPlayerVehicleID(playerid);
if(Engine[vehicle] == 1)
{
new engine,lights,alarm,doors,bonnet,boot,objective; //Same procedure, this is defining the variables
Engine[vehicle] = 0; //This bit here, is quite vital. because if you left it at: Engine[vehicle] = 0; Then the vehicle would turn off, then not start again unless respawned.
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);//This bit is setting the engine to be turned off.
}
else return SendClientMessage(playerid, GREY, "This vehicle's engine is already off.");//This will display on the screen if the engine is already off.
}
else return SendClientMessage(playerid, GREY, "You must be in the drivers seat of a vehicle.");//This message will display on the screen if the player doing the command isn't in the drivers seat of a vehicle
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)