PDA

View Full Version : command in interior


kingcrome
12/11/2013, 08:19 PM
Hello i Want to make a command in an interior. E.g /buygun in the gunstore interior

Luis-
12/11/2013, 08:24 PM
Make one then?

Lynn
12/11/2013, 08:30 PM
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;
}

[CG]Milito
12/11/2013, 08:38 PM
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


if(GetPlayerInterior(playerid) == 1)
{
Code Here!
}
else
{
code here!
}


instead of checking the position

kingcrome
12/11/2013, 08:52 PM
Thank you CG

Lynn
12/11/2013, 09:33 PM
Milito;2779994']Just use


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.