How to make a /robatm command only available when your near an ATM
#1

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?
Reply
#2

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

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

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

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.
Reply
#6

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!
Reply
#7

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

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.
Reply
#9

Код:
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 !");
}
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)