Disable weapons only in ammunation interiors
#1

Hello

I want to disable weapons inside ammunation interiors. I don't want to disable them in all interiors.

Just when player enter to ammunation his weapons scroll and he can't use them until he exit from ammunation.

I think it's something like AllowInteriorWeapons , but it disables weapons in all interiors.

Thanks for your help.
Reply
#2

You can check if the player is in an ammunation by using IsPlayerInRangeOfPoint, then if they are, SetPlayerArmedWeapon(playerid, 0); which will set their weapon to knuckles. I suppose you'll wanna create a player loop and the if statement, quick example:

pawn Код:
forward playerLoop();
public playerLoop()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i, 15, x, y, z))
        {
            SetPlayerArmedWeapon(i, 0);
        }
    }
}
You'll need to grab the coordinates yourself, and replace them with the x, y and z, you'll probably also want to create a few other code blocks, seeing as there's various ammunations:

pawn Код:
if(IsPlayerInRangeOfPoint(i, 15, x, y, z) || IsPlayerInRangeOfPoint(i, 15, x, y, z))
Don't forget to grab the coordinates.

You'll also need to set a timer for this loop, so it repeats, add this to OnGameModeInit:

Код:
SetTimer("playerLoop", 1000, true);
Reply
#3

Quote:
Originally Posted by Calgon
Посмотреть сообщение
You can check if the player is in an ammunation by using IsPlayerInRangeOfPoint, then if they are, SetPlayerArmedWeapon(playerid, 0); which will set their weapon to knuckles. I suppose you'll wanna create a player loop and the if statement, quick example:

pawn Код:
forward playerLoop();
public playerLoop()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i, 15, x, y, z))
        {
            SetPlayerArmedWeapon(i, 0);
        }
    }
}
You'll need to grab the coordinates yourself, and replace them with the x, y and z, you'll probably also want to create a few other code blocks, seeing as there's various ammunations:

pawn Код:
if(IsPlayerInRangeOfPoint(i, 15, x, y, z) || IsPlayerInRangeOfPoint(i, 15, x, y, z))
Don't forget to grab the coordinates.

You'll also need to set a timer for this loop, so it repeats, add this to OnGameModeInit:

Код:
SetTimer("playerLoop", 1000, true);
Thank you.

EDIT: Its not working.
Reply
#4

Quote:
Originally Posted by Cypress
Посмотреть сообщение
Thank you.

EDIT: Its not working.
...read what I said... you need to get the coordinates YOURSELF.
Reply
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
...read what I said... you need to get the coordinates YOURSELF.
Код:
public playerLoop()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(1, 15, 292.72, -108.23, 1001.51))
        {
            SetPlayerArmedWeapon(i, 0);
        }
    }
}
Its not working i tested it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)