SA-MP Forums Archive
enter/exit garage help - 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: enter/exit garage help (/showthread.php?tid=641030)



enter/exit garage help - xLucy - 10.09.2017

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


Re: enter/exit garage help - Kane - 10.09.2017

What IS the issue?

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


Re: enter/exit garage help - xLucy - 10.09.2017

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

^


Re: enter/exit garage help - Kane - 10.09.2017

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!");



Re: enter/exit garage help - JasonRiggs - 10.09.2017

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


Re: enter/exit garage help - xLucy - 10.09.2017

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


Re: enter/exit garage help - Kane - 10.09.2017

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.



Re: enter/exit garage help - xLucy - 10.09.2017

Already got crash detect. I'll try it.


Re: enter/exit garage help - 10MIN - 10.09.2017

@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.


Re: enter/exit garage help - xLucy - 10.09.2017

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