SA-MP Forums Archive
How to make a /robatm command only available when your near an ATM - 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: How to make a /robatm command only available when your near an ATM (/showthread.php?tid=349356)



How to make a /robatm command only available when your near an ATM - stormchaser206 - 08.06.2012

I am making a CnR script, and i have like 50 atms all around san fierro. And i dont really want to have to use IsPlayerInRangeOfPoint at every atm. Can someone help please?


Re: How to make a /robatm command only available when your near an ATM - [KHK]Khalid - 08.06.2012

Sounds impossible to do it without IsPlayerInRangeOfPoint. But let's see. What are you using for the atms checkpoints, pickups or what?


Re: How to make a /robatm command only available when your near an ATM - stormchaser206 - 08.06.2012

I am not using anyof those. I am using 2 commands, /robatm and /useatm. Will i have to change it or something?


Re: How to make a /robatm command only available when your near an ATM - [KHK]Khalid - 08.06.2012

I mean how do you detect if a player is nearby an atm in your server or players can use it wherever they are?


Re: How to make a /robatm command only available when your near an ATM - stormchaser206 - 08.06.2012

That, i dont know. I dont really want to create a pickup for every single ATM,
and i dont want a streamer for checkpoints...
So, ya, idk.


Re: How to make a /robatm command only available when your near an ATM - [KHK]Khalid - 08.06.2012

Well I know it's hard to do but you should know that it's for the sake of your server, aren't I right? And why no streamers? The most of the great servers there use them!


Re: How to make a /robatm command only available when your near an ATM - stormchaser206 - 08.06.2012

Well, if i create all those pickups, my script will look messed up.


Re: How to make a /robatm command only available when your near an ATM - zDevon - 08.06.2012

You can use IsPlayerInRangeOfPoint without checkpoints and pickups and all that.

Use the XY and Z points that you use to create the ATM object itself.


Re: How to make a /robatm command only available when your near an ATM - mineralo - 08.06.2012

Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
use this, its useful to detecte is near a place like
pawn Код:
if(PlayerToPoint(4,playerid,0,0,0)
{
//your code
}
else
{
SendClientMessage(playerid,COLOR,"You're not near it !");
}



Re: How to make a /robatm command only available when your near an ATM - stormchaser206 - 08.06.2012

Quote:
Originally Posted by mineralo
Посмотреть сообщение
Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
use this, its useful to detecte is near a place like
pawn Код:
if(PlayerToPoint(4,playerid,0,0,0)
{
//your code
}
else
{
SendClientMessage(playerid,COLOR,"You're not near it !");
}
I dont get anything in that code...