command in interior
#1

Hello i Want to make a command in an interior. E.g /buygun in the gunstore interior
Reply
#2

Make one then?
Reply
#3

pawn Код:
if(strcmp("/buygun", cmd, true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 0.0, 0.0, 0.0))//You must decide what X, Y, Z they must be at.
    {
        if(GetPlayerMoney(playerid) >= 500)
        {
            GivePlayerWeapon(playerid, 24, 57);// Full clip + 50 bullets.
            GivePlayerMoney(playerid, -500); // 500$ Will be deducted.
        }
        else
        {
            SendClientMessage(playerid, -1, #You do not have $500);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, #You are not at the gun store);
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Lynn
Посмотреть сообщение
pawn Код:
if(strcmp("/buygun", cmd, true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 0.0, 0.0, 0.0))//You must decide what X, Y, Z they must be at.
    {
        if(GetPlayerMoney(playerid) >= 500)
        {
            GivePlayerWeapon(playerid, 24, 57);// Full clip + 50 bullets.
            GivePlayerMoney(playerid, -500); // 500$ Will be deducted.
        }
        else
        {
            SendClientMessage(playerid, -1, #You do not have $500);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, #You are not at the gun store);
    }
    return 1;
}
Just use

pawn Код:
if(GetPlayerInterior(playerid) == 1)
{
   Code Here!
}
else
{
   code here!
}

instead of checking the position
Reply
#5

Thank you CG
Reply
#6

Quote:
Originally Posted by [CG]Milito
Посмотреть сообщение
Just use

pawn Код:
if(GetPlayerInterior(playerid) == 1)
{
   Code Here!
}
else
{
   code here!
}

instead of checking the position
Only one Gun Store interior is ID 1, so unless that's the exact interior he has in his script, that method will not work. And, if he's in any other interior that is = to 1, the command will work in that as-well.
That method is just asking for bugs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)