SA-MP Forums Archive
I dont know where to put this bit of code - 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: I dont know where to put this bit of code (/showthread.php?tid=356755)



I dont know where to put this bit of code - Euan Hughes - 04.07.2012

Hello well i have this thing with IsPlayerInArea and i dont know where to put it

I pretty much want to check if a truck has not got a trailer attached to it and it enters a certain point it will respawn the truck...

Please help

pawn Код:
forward IsPlayerInArea(playerid, x1, x2, y1, y2);
pawn Код:
forward IsPlayerInArea(playerid, x1, x2, y1, y2);
public IsPlayerInArea(playerid,x1, x2, y1, y2)
{
    new Float:xx, Float:yy, Float:zz; GetPlayerPos(playerid, xx, yy, zz);
    if(xx > x1 && xx < x2 && yy > y1 && yy < y2) return 1;
    else return 0;
}
If you need any more code just ask

Please help

Thanks


Respuesta: I dont know where to put this bit of code - farCry.xD - 04.07.2012

You need to put it in the fornt of the script.. Over all defines..


Re: Respuesta: I dont know where to put this bit of code - Euan Hughes - 04.07.2012

Quote:
Originally Posted by farCry.xD
Посмотреть сообщение
You need to put it in the fornt of the script.. Over all defines..
I know that but where do i put it like for example would i do this

pawn Код:
OnPlayerStateChange(playerid, newstate, oldstate)
{
           if(IsPlayerInArea(playerid, x, x, y, y)
           {
                  // Code here
           }
}
If you need any more code just ask

Please help

Thanks


Re: I dont know where to put this bit of code - tyler12 - 04.07.2012

outside of everything


Re: I dont know where to put this bit of code - Euan Hughes - 04.07.2012

Quote:
Originally Posted by tyler12
Посмотреть сообщение
outside of everything
Yes... but where can i put the code to check if the player is in the area..


Re: I dont know where to put this bit of code - Tee - 04.07.2012

You would have to get the minx maxx miny and maxy co-ordinates for the area you're checking if the player is in. I think you can use MapAndreas to aid you in doing that.


Re: I dont know where to put this bit of code - Euan Hughes - 04.07.2012

Quote:
Originally Posted by Tee
Посмотреть сообщение
You would have to get the minx maxx miny and maxy co-ordinates for the area you're checking if the player is in. I think you can use MapAndreas to aid you in doing that.
I dont think any one knows what im trying to do

Pretty much where would i put this bit of code

pawn Код:
if(IsPlayerInArea(playerid, x, x, y, y)
{
        // Code here
}
Where abouts would i put that in what bit

OnPlayerStateChange

OnPlayerStateKeyChange

If you need any more code just ask

Please help

Thanks


Re: I dont know where to put this bit of code - CrazyChoco - 04.07.2012

Scroll down to the button of the script, press enter 4 times and paste the code.