SA-MP Forums Archive
/enter not work ,i try 10 times - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /enter not work ,i try 10 times (/showthread.php?tid=251955)



/enter not work ,i try 10 times - Aizen - 29.04.2011

Well i try 10 times why this code not work -_-

code:

Код:
#include < a_samp >
new CheckPoint;

public OnGameModeInit()
{
    DisableInteriorEnterExits( );
    CheckPoint = CreatePickup(1318,1,1411.9040527344, -1699.5897216797, 13.787961959839);
    
    
    return 1;
}

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/enter", cmdtext, true, 6) == 0)
    {
        if( IsPlayerInRangeOfPoint( playerid,10,1411.9040527344, -1699.5897216797, 13.787961959839 ) )
        {
            SetPlayerPos( playerid,501.77899169922, -67.483757019043, 998.25628662109 );
			SetPlayerInterior(playerid,11);

			return 1;
        }
    }
    if( strcmp( "/exit",cmdtext,true,6) == 0)
    {
        if( IsPlayerInRangeOfPoint( playerid,10,501.77899169922, -67.483757019043, 998.25628662109 ) )
        {
            SetPlayerPos( playerid,1411.9040527344, -1699.5897216797, 13.787961959839 );
            SetPlayerInterior(playerid,0);
            
            return 1;
        }
    }
    return 0;
}
public OnPlayerPickUpPickup( playerid, pickupid )
{
    if(pickupid == CheckPoint)
        {
        GameTextForPlayer(playerid,"~r~ /enter ~y~ to enter this building",3000,1);
        }
	return 1;
}



Re: /enter not work ,i try 10 times - NotoriousMOB - 29.04.2011

You getting errors?


Re: /enter not work ,i try 10 times - Aizen - 29.04.2011

Not,i cant enter -_-


Re: /enter not work ,i try 10 times - JaTochNietDan - 29.04.2011

Try do some debugging, also I would recommend moving your return value like I have done in this example:

pawn Код:
if( strcmp( "/enter", cmdtext, true, 6) == 0)
{
    print("Success 1");
    if( IsPlayerInRangeOfPoint( playerid,10,1411.9040527344, -1699.5897216797, 13.787961959839 ) )
    {
        print("Success 2");
        SetPlayerPos( playerid,501.77899169922, -67.483757019043, 998.25628662109 );
        SetPlayerInterior(playerid,11);    
    }
    print("Success 3");
    return 1;
}
What exactly goes wrong? Also please try that and tell me what it prints, this is how we debug problems with code!


Re: /enter not work ,i try 10 times - Medal Of Honor team - 29.04.2011

Check your co-ordinates. Debug your script like this

pawn Код:
#include < a_samp >
new CheckPoint;

public OnGameModeInit()
{
    DisableInteriorEnterExits( );
    CheckPoint = CreatePickup(1318,1,1411.9040527344, -1699.5897216797, 13.787961959839);
   
   
    return 1;
}

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/enter", cmdtext, true, 6) == 0)
    {
        if( IsPlayerInRangeOfPoint( playerid,10,1411.9040527344, -1699.5897216797, 13.787961959839 ) )
        {
            SetPlayerPos( playerid,501.77899169922, -67.483757019043, 998.25628662109 );
        SetPlayerInterior(playerid,11);
            return 1;
        }
        else
        {
           SendClientMessage(playerid, color, "The coordiantes is not correct");
           return 1;
        }
    }
    if( strcmp( "/exit",cmdtext,true,6) == 0)
    {
        if( IsPlayerInRangeOfPoint( playerid,10,501.77899169922, -67.483757019043, 998.25628662109 ) )
        {
            SetPlayerPos( playerid,1411.9040527344, -1699.5897216797, 13.787961959839 );
            SetPlayerInterior(playerid,0);
            return 1;
        }
        else
        {
           SendClientMessage(playerid, color, "The coordiantes is not correct");
           return 1;
        }
    }
    return 0;
}
public OnPlayerPickUpPickup( playerid, pickupid )
{
    if(pickupid == CheckPoint)
        {
        GameTextForPlayer(playerid,"~r~ /enter ~y~ to enter this building",3000,1);
        }
    return 1;
}



Re: /enter not work ,i try 10 times - Berky - 29.04.2011

Maybe you're using a FilterScript which is conflicting this GameMode.