SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/10/2019, 04:10 PM   #21
KensPTV
Big Clucker
 
KensPTV's Avatar
 
Join Date: Oct 2019
Location: Vietnamese
Posts: 72
Reputation: 0
Default Re: Show Notifications [Come in/Get out] Safezone

Quote:
Originally Posted by Lokii View Post
Theres no cration i see /gotosz /szedit and /szdelete

I made an example:

PHP Code:
#include <a_samp>
#include <streamer>

#define MAX_SAFE_ZONES (4) //how many safe zones

new Float:safe_zones[MAX_SAFE_ZONES][5] =
{
    
//X       Y           Z       SIZE_X  SIZE_Y
    
{1.951041531.9417711.5052662.062.0},
    {-
0.801471368.634648.1372044.044.0},
    {-
91.355801358.402229.2533225.031.5},
    {-
88.651391217.8757318.7317535.525.0}
};

new 
safe_zone[MAX_SAFE_ZONES]; //where we will store areas

public OnFilterScriptInit() //use gamemode init if gamemode
{
    for(new 
0sizeof(safe_zones); i++)
    {
        
//createcube area: x-x_size y-y_size, z, x+x_size, y+y_size, z = 800 you can chage z
        
safe_zone[i] = CreateDynamicCube(safe_zones[i][0]-safe_zones[i][3], safe_zones[i][1]-safe_zones[i][4], safe_zones[i][2], safe_zones[i][0]+safe_zones[i][3], safe_zones[i][1]+safe_zones[i][4], 1800.0);
    }
    return 
1;
}

public 
OnFilterScriptExit() //use gamemode init if gamemode
{
    for(new 
0sizeof(safe_zones); i++)
    {
        
DestroyDynamicArea(safe_zone[i]); //destroying all dynamic areas
    
}
    return 
1;
}

public 
OnPlayerEnterDynamicArea(playeridareaid)
{
    for(new 
0MAX_SAFE_ZONESi++)
    {
        if(
areaid != safe_zone[i]) continue; //if not the safe_zone we entered or not safe zone at all skip
        
PlayerPlaySound(playerid10570.00.00.0); //
        
SendClientMessage(playerid0x00FF00FF"Entered Safe Zone");
        break; 
//break loop no need to loop for all if we allready enter
    
}
    return 
1;
}

public 
OnPlayerLeaveDynamicArea(playeridareaid)
{
    for(new 
0MAX_SAFE_ZONESi++)
    {
        if(
areaid != safe_zone[i]) continue; //if not the safe_zone we entered or not safe zone at all skip
        
PlayerPlaySound(playerid10580.00.00.0);
        
SendClientMessage(playerid0xFF0000FF"Left Safe Zone");
        break; 
//break loop no need to loop for all if we allready enter
    
}
    return 
1;

- Hey bro, when I added your code it was like this. Watch the video you will see clearly. FULL HD 1080
https://www.youtube.com/watch?v=a0ir...ature=youtu.be
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 23/10/2019, 05:31 PM   #22
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Re: Show Notifications [Come in/Get out] Safezone

it works fine for me, i break the loop once enter the zone, you probably added what i send you and placed it inside a loop
__________________
Lokii is offline   Reply With Quote
Old 24/10/2019, 02:05 PM   #23
KensPTV
Big Clucker
 
KensPTV's Avatar
 
Join Date: Oct 2019
Location: Vietnamese
Posts: 72
Reputation: 0
Default Re: Show Notifications [Come in/Get out] Safezone

Quote:
Originally Posted by Lokii View Post
it works fine for me, i break the loop once enter the zone, you probably added what i send you and placed it inside a loop
- Hey bro @Lokki, i complete it !!! Thanks you very much <3
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SAMP & Notifications OpCodexo Scripting Help 4 15/12/2016 10:02 AM
What is Notifications?. UnClear Client Support 6 19/01/2014 12:11 PM
[FORUM BUG]: Notifications Konstantinos Everything and Nothing 7 31/07/2013 12:09 PM
Desktop PM notifications from In-Game! Chaprnks Everything and Nothing 19 13/05/2013 02:51 PM
TextDraw and notifications... AiVAMAN Help Archive 1 14/01/2010 01:06 PM


All times are GMT. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.