enter/exit garage help
#1

PHP код:
CMD:entergarage(playeridparams[])
    if(
IsPlayerInRangeOfPoint(playerid5.0265.9687,115.3523,1004.6172))
    {
        
oldvw[playerid] = GetPlayerVirtualWorld(playerid);
        
SetPlayerPos(playerid1568.6774,-1689.9703,6.2188);
        
SetPlayerInterior(playerid0);
        
SetPlayerVirtualWorld(playerid0);
    }
    
//SFPD Garage
    
if(IsPlayerInRangeOfPoint(playerid5.0, -1631.3282,683.6899,6.9591))
    {
        if(
PlayerInfo[playerid][pFaction] == 2)
        {
            new 
veh GetPlayerVehicleID(playerid), cseat GetPlayerVehicleSeat(playerid), incar IsPlayerInAnyVehicle(playerid);
            
SetPlayerPos(playerid1590.1838,-1646.0953,11.6225);
            
SetPlayerInterior(playerid0);
               
SetPlayerVirtualWorld(playerid0);
            
SetPlayerFacingAngle(playerid200.2718);
            if(
incar == true && cseat == 0)
            {
                
SetVehiclePos(veh1590.1838,-1646.0953,11.6225);
                
PutPlayerInVehicle(playeridveh0);
            }
            else if(
cseat == || cseat == || cseat == 3) return SCM(playeridCOLOR_LIGHTRED"Error: You are not the driver of this vehicle!");
        }
        else if(
PlayerInfo[playerid][pFaction] != 2) return printf("[server] %s has attempted to enter the PD garage!"GetName(playerid));
    }
    return 
1;
}
CMD:exitgarage(playeridparams[])
{
    if(
IsPlayerInRangeOfPoint(playerid2.01568.7365,-1689.9713,6.2188))
    {
        
SetPlayerPos(playerid265.9687,115.3523,1004.6172);
        
SetPlayerInterior(playerid10);
        
SetPlayerVirtualWorld(playerid5);
    }
    
//SFPD Garage
    
if(IsPlayerInRangeOfPoint(playerid5.01590.1838,-1646.0953,11.6225))
    {
        if(
PlayerInfo[playerid][pFaction] == 2)
        {
            
/*if(IsPlayerInAnyVehicle(playerid) == true && GetPlayerVehicleSeat(playerid) == 0)
            {
                new veh = GetPlayerVehicleID(playerid);
                SetPlayerPos(playerid, -1631.3282,683.6899,6.9591);
                SetVehiclePos(veh, -1631.3282,683.6899,6.9591);
                SetPlayerInterior(playerid, 0);
                   SetPlayerVirtualWorld(playerid, 0);
                SetPlayerFacingAngle(playerid, 90)
                PutPlayerInVehicle(playerid, veh, 0);
            }
            else if(IsPlayerInAnyVehicle(playerid) == true && GetPlayerVehicleSeat(playerid) != 0) return SCM(playerid, COLOR_LIGHTRED, "Error: You are not the driver of this vehicle!");
            else if(IsPlayerInAnyVehicle(playerid) == false)
            {
                SetPlayerPos(playerid, -1631.3282,683.6899,6.9591);
                SetPlayerInterior(playerid, 0);
                SetPlayerFacingAngle(playerid, 90)
                   SetPlayerVirtualWorld(playerid, 0);
            }*/
                
new veh GetPlayerVehicleID(playerid), cseat GetPlayerVehicleSeat(playerid), incar IsPlayerInAnyVehicle(playerid);
                
SetPlayerPos(playerid, -1631.3282,683.6899,6.9591);
                
SetPlayerInterior(playerid0);
                   
SetPlayerVirtualWorld(playerid0);
                
SetPlayerFacingAngle(playerid90);
                if(
incar == true && cseat == 0)
                {
                    
SetVehiclePos(veh, -1631.3282,683.6899,6.9591);
                    
PutPlayerInVehicle(playeridveh0);
                }
                else if(
cseat == || cseat == || cseat == 3) return SCM(playeridCOLOR_LIGHTRED"Error: You are not the driver of this vehicle!");
        }
        else if(
PlayerInfo[playerid][pFaction] != 2) return printf("[server] %s has attempted to enter the PD garage!"GetName(playerid));
    }
    return 
1;

What's the issue with this code that is making my pawno compiler crash.

NOTE: the code that has been marked out was removed because i tried to do this the other way that wasn't marked out
Reply
#2

What IS the issue?

It's your code. Are you getting an error while compiling?
Reply
#3

What's the issue with this code that is making my pawno compiler crash.

^
Reply
#4

You edited with more details, OK.

Your codes really messy and could be shortened. You're using one too many variables to check if a player is in a vehicle.

You could do:
PHP код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
    
SetPlayerPos(playeridxyz);
}
else
{
    
SetVehiclePos(GetPlayerVehicleID(playerid), xyz);

Doing this is bad:
Код:
if(incar == true && cseat == 0) 
                { 
                    SetVehiclePos(veh, -1631.3282,683.6899,6.9591); 
                    PutPlayerInVehicle(playerid, veh, 0); 
                } 
                else if(cseat == 1 || cseat == 2 || cseat == 3) return SCM(playerid, COLOR_LIGHTRED, "Error: You are not the driver of this vehicle!");
Reply
#5

He already said that it crashes his compiler,try using Zeex compiler search the forums at Includes section
Reply
#6

Still crashing. And yes, I know that my code is hella fuckin' messy, lmao. I'm somewhat new to PAWN.
Reply
#7

What did you change?

When does it crash? What command did you use? Can you post your server logs?

Also:
Quote:

Get the crashdetect plugin.

https://sampforum.blast.hk/showthread.php?tid=262796
https://github.com/Zeex/samp-plugin-...etect/releases

Create a pawn.cfg file inside your Pawno directory with just "-d3" inside and recompile and restart.
This should show where your error is coming from.
Reply
#8

Already got crash detect. I'll try it.
Reply
#9

@JassonRiggs Zeex's Compiler (original and latest): https://github.com/Zeex/pawn/releases
@OP Try to comment and uncomment parts of the code to see which is issued.
Reply
#10

Yeah no the whole PAWN compiler crashdetect thing aint workin. I'll try zeex's complier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)