command in interior - 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: command in interior (
/showthread.php?tid=475391)
command in interior -
kingcrome - 12.11.2013
Hello i Want to make a command in an interior. E.g /buygun in the gunstore interior
Re: command in interior -
Luis- - 12.11.2013
Make one then?
Re: command in interior -
Lynn - 12.11.2013
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;
}
Respuesta: Re: command in interior -
[CG]Milito - 12.11.2013
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
Re: command in interior -
kingcrome - 12.11.2013
Thank you CG
Re: Respuesta: Re: command in interior -
Lynn - 12.11.2013
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.