[HELP] Enter and Exit system ( buildings )
#1

I am just learning to script pawn. I was trying to make a house with a Mad Dog Interior. The command ' /enter ' is alright. But when I ' /exit ' nothing happens. Please do help me



Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/enter", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 2807.9045,-1176.4122,25.3834))
        {
            SetPlayerPos(playerid, 1267.663208,-781.323242,1091.906250);
            SetPlayerInterior(playerid, 5);
        }
        return 1;
    }
    if(!strcmp(cmdtext, "/exit", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1267.663208,-781.323242,1091.906250))
        {
			SetPlayerPos(playerid, 2807.9045,-1176.4122,25.3834);
			SetPlayerInterior(playerid, 0);
        }
        return 1;
    }

    return 0;
}
Thanks in advance!
Reply
#2

You've probably typed /exit near the doors and you've sett it little further. On the command /exit change if(IsPlayerInRangeOfPoint(....) to this:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1260.6460,-785.4182,1091.9063))
{
    SetPlayerPos(playerid, 2807.9045,-1176.4122,25.3834);
    SetPlayerInterior(playerid, 0);
}
Reply
#3

Quote:
Originally Posted by RockyGamer
Посмотреть сообщение
You probably typed /exit near the doors and you setted it little further. On command /exit change if(IsPlayerInRangeOfPoint(....) to this:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1260.6460,-785.4182,1091.9063))
{
    SetPlayerPos(playerid, 2807.9045,-1176.4122,25.3834);
    SetPlayerInterior(playerid, 0);
}
There in nothing wrong with the coordinates. I didn't try it near the door. I tried it at the precise location. Anyway I am gonna try your coords.
Thanks


And if I create another house with the same interior and two persons enter their houses at the same time wouldn't they be in exactly the same houses?

--------------

I tried it.. And still no hope.
Reply
#4

Try to use pickups instead of /enter /exit commands.
Pickup ids: http://weedarr.wikidot.com/pickups
Create pickups from samp wiki: https://sampwiki.blast.hk/wiki/CreatePickup
Tutorial for pickups: https://sampforum.blast.hk/showthread.php?tid=327953
Types of pickups(spawn pickup types): https://sampwiki.blast.hk/wiki/PickupTypes
If you don't understand tutorial, but you understand Creating pickups from samp wiki:
pawn Код:
new pickup;
public OnGameModeInit()
{
       pickup = CreatePickup(model(I recommend you ID 1239), type(I put types in description), X cordinates, Z cordinates, Y cordinates, choose virtual world(if you want that pickup in all worlds set this to "-1");
       return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
       if(pickupid == pickup)
       {
               SetPlayerPos(playerid, X, Y, Z);
               SetPlayerInterior(playerid, (interiorid that you want));
       }
}
Note: if you use something like this pawn code you need to create pickup for exit too, so that pickup need to contain diffrent pickup id and other things.
I hope you understant that now and if you alredy know it then sorry.
If it helped rep++?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)