SA-MP Forums Archive
Range - 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: Range (/showthread.php?tid=584753)



Range - Fancy - 07.08.2015

I have a derby map and its located on the water,how to make it like when someone falls on water so the player loses


Re: Range - Battlezone - 07.08.2015

You can make a timer with a 5s interval that will check the player z coordinate and compare it to the water Z surface coords, if the player Z < water surface Z he loses

Under on player spawn:

Код:
//your code
//...
 
    // Start a 5 second timer to end the anti-spawnkill
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    SetTimerEx("CheckZ", 5000, false, "if", playerid, Z);


//then after on player spawn

forward CheckZ(playerid, zcoord);
 
// The timer function - the code to be executed when the timer is called goes here
public CheckZ(playerid, zcoord)
{
    if(Z<10.00) //10.00 is surface Z for example
    {
    //lose functions and variables
     }
    return 1;
}



Re: Range - SickAttack - 07.08.2015

Use streamer, create an area and when they leave it, do your magic and mark them as out of the game.


Re: Range - Fancy - 07.08.2015

Quote:
Originally Posted by Battlezone
Посмотреть сообщение
You can make a timer with a 5s interval that will check the player z coordinate and compare it to the water Z surface coords, if the player Z < water surface Z he loses

Under on player spawn:

Код:
//your code
//...
 
    // Start a 5 second timer to end the anti-spawnkill
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    SetTimerEx("CheckZ", 5000, false, "if", playerid, Z);


//then after on player spawn

forward CheckZ(playerid, zcoord);
 
// The timer function - the code to be executed when the timer is called goes here
public CheckZ(playerid, zcoord)
{
    if(Z<10.00) //10.00 is surface Z for example
    {
    //lose functions and variables
     }
    return 1;
}
Can i do it without timer and making it under OnPlayerUpdate()?


Re: Range - SickAttack - 07.08.2015

Quote:
Originally Posted by Fancy
Посмотреть сообщение
Can i do it without timer and making it under OnPlayerUpdate()?
Use areas...


Re: Range - Fancy - 07.08.2015

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Use streamer, create an area and when they leave it, do your magic and mark them as out of the game.
How can i do it?
give me an example please


Re: Range - SickAttack - 07.08.2015

Quote:
Originally Posted by Fancy
Посмотреть сообщение
How can i do it?
give me an example please
There is no need for any examples.

pawn Код:
native STREAMER_TAG_AREA CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);

forward OnPlayerEnterDynamicArea(playerid, STREAMER_TAG_AREA areaid);
forward OnPlayerLeaveDynamicArea(playerid, STREAMER_TAG_AREA areaid);
You have everything you need here: https://sampforum.blast.hk/showthread.php?tid=102865


Re: Range - Fancy - 07.08.2015

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
There is no need for any examples.

pawn Код:
native STREAMER_TAG_AREA CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);

forward OnPlayerEnterDynamicArea(playerid, STREAMER_TAG_AREA areaid);
forward OnPlayerLeaveDynamicArea(playerid, STREAMER_TAG_AREA areaid);
You have everything you need here: https://sampforum.blast.hk/showthread.php?tid=102865
But how can i get the cordinates of dynamic area?
And i dont know how to use it


Re: Range - SickAttack - 07.08.2015

Quote:
Originally Posted by Fancy
Посмотреть сообщение
But how can i get the cordinates of dynamic area?
And i dont know how to use it
With /save and airbreak or something similar.


Re: Range - Battlezone - 08.08.2015

Quote:
Originally Posted by Fancy
Посмотреть сообщение
Can i do it without timer and making it under OnPlayerUpdate()?
Yes of course, you can