SA-MP Forums

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

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

- Hi guys, I need everyone to help with the problem:
* + " Get out of the safezone -> show line SendClientMessage(playerid,-1,[!]You are out of the safezone.) "
* + " In the safezone -> show line SendClientMessage(playerid,-1,[!]You have entered the safezone.) "

- Example:
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 20/10/2019, 05:18 PM   #2
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 327
Reputation: 22
Default Re: Show Notifications [Come in/Get out] Safezone

Streamer
Code:
public OnPlayerEnterDynamicArea(playerid, areaid)
public OnPlayerLeaveDynamicArea(playerid, areaid)
If Normal Area,
Code:
public OnPlayerEnterArea(playerid, areaid)
public OnPlayerLeaverea(playerid, areaid)
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Old 20/10/2019, 06:10 PM   #3
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

- Can you give more specific instructions?
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 20/10/2019, 06:12 PM   #4
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:
CMD: gotosz(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99999 || PlayerInfo[playerid][pShopTech] == 1)
{
new housenum;
if(sscanf(params, "d", housenum)) return SendClientMessageEx(playerid, COLOR_GREY, "SUDUNG: /gotosz [ID Khu An Toan]");

SetPlayerPos(playerid,SafeZoneInfo[housenum][szExteriorX],SafeZoneInfo[housenum][szExteriorY],SafeZoneInfo[housenum][szExteriorZ]);
GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
SetPlayerInterior(playerid, 0);
PlayerInfo[playerid][pInt] = 0;
}
return 1;
}


CMD: szedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99999)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong du kha nang de su dung lenh nay`.");
return 1;
}

new string[128], choice[32], szid, amount;
if(sscanf(params, "s[32]dd", choice, szid, amount))
{
SendClientMessageEx(playerid, COLOR_GREY, "SUDUNG: /szedit [name] [Khu An Toan ID] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Toado, Khoangcach");
return 1;
}
if(strcmp(choice, "toado", true) == 0)
{
GetPlayerPos(playerid, SafeZoneInfo[szid][szExteriorX], SafeZoneInfo[szid][szExteriorY], SafeZoneInfo[szid][szExteriorZ]);
SendClientMessageEx( playerid, COLOR_WHITE, "Ban da chinh sua toa do Khu An Toan!" );
DestroyPickup(SafeZoneInfo[szid][szPickupID]);
SaveSafeZones();

format(string, sizeof(string), "%s da chinh sua toa do Khu An Toan (ID %d).", GetPlayerNameEx(playerid), szid);
Log("logs/khuantoan.log", string);

DestroyPickup(SafeZoneInfo[szid][szPickupID]);
DestroyDynamic3DTextLabel(SafeZoneInfo[szid][szTextID]);
format(string, sizeof(string), "{DF0101}[Khu vuc an toan]\n(ID: %d)\n{24D12F}Pham vi: {FF0000}[%d] {24D12F}Metter\n{DF0101}[!]{FFD100}Khong duoc Safezone",szid,SafeZoneInfo[szid][szKhoangcach]);
SafeZoneInfo[szid][szTextID] = CreateDynamic3DTextLabel( string, COLOR_WHITE, SafeZoneInfo[szid][szExteriorX], SafeZoneInfo[szid][szExteriorY], SafeZoneInfo[szid][szExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
SafeZoneInfo[szid][szPickupID] = CreatePickup(1314, 23, SafeZoneInfo[szid][szExteriorX], SafeZoneInfo[szid][szExteriorY], SafeZoneInfo[szid][szExteriorZ]);
}
else if(strcmp(choice, "Khoangcach", true) == 0)
{
SafeZoneInfo[szid][szKhoangcach] = amount;
SendClientMessageEx( playerid, COLOR_WHITE, "Ban da chinh sua khoang cach Khu An Toan." );
SaveSafeZones();

format(string, sizeof(string), "%s da chinh sua khoang cach Khu An Toan (ID %d).", GetPlayerNameEx(playerid), szid);
Log("logs/khuantoan.log", string);

DestroyDynamic3DTextLabel(SafeZoneInfo[szid][szTextID]);
format(string, sizeof(string), "{DF0101}[Khu vuc an toan]\n(ID: %d)\n{24D12F}Pham vi: {FF0000}[%d] {24D12F}Metter\n{DF0101}[!]{FFD100}Khong duoc Safezone",szid,SafeZoneInfo[szid][szKhoangcach]);
SafeZoneInfo[szid][szTextID] = CreateDynamic3DTextLabel( string, COLOR_WHITE, SafeZoneInfo[szid][szExteriorX], SafeZoneInfo[szid][szExteriorY], SafeZoneInfo[szid][szExteriorZ]+0.5,10.0, .testlos = 1, .streamdistance = 10.0);
}
SaveSafeZones();
return 1;
}


CMD: szdelete(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99999)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong du kha nang de su dung lenh nay`!");
return 1;
}
new h, string[128];
if(sscanf(params,"d",h)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /szdelete [Khu An Toan ID]");
if(!IsValidDynamicPickup(SafeZoneInfo[h][szPickupID])) return SendClientMessage(playerid, COLOR_WHITE,"Khu An Toan do khong ton tai.");
SafeZoneInfo[h][szExteriorX] = 0;
SafeZoneInfo[h][szExteriorY] = 0;
SafeZoneInfo[h][szExteriorZ] = 0;
DestroyDynamicPickup(SafeZoneInfo[h][szPickupID]);
DestroyDynamic3DTextLabel(SafeZoneInfo[h][szTextID]);
SaveSafeZones();
format(string, sizeof(string), "Ban da xoa Khu An Toan (ID %d).", h);
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s da xoa Khu An Toan (ID %d).", GetPlayerNameEx(playerid), h);
Log("logs/khuantoan.log", string);
return 1;
}
- That is my code, you can help me ?
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 20/10/2019, 06:17 PM   #5
WalkZ
Big Clucker
 
WalkZ's Avatar
 
Join Date: Oct 2019
Location: Pakistan
Posts: 82
Reputation: 4
Default Re: Show Notifications [Come in/Get out] Safezone

Quote:
Originally Posted by SiaReyes View Post
Streamer
Code:
public OnPlayerEnterDynamicArea(playerid, areaid)
public OnPlayerLeaveDynamicArea(playerid, areaid)
If Normal Area,
Code:
public OnPlayerEnterArea(playerid, areaid)
public OnPlayerLeaverea(playerid, areaid)
You are right about streamer but about normal there is no default function in samp named OnPlayerEnterArea or OnPlayerLeaveArea.
__________________
[EN] Chinatown Freeroam [BETA]
- Different Advanced Deathmatches with Times and Scores
- Different Races
- Different Events
- Gangs (Groves, Ballas, Aztecas, Mafia, Bikers & Triads)
- Drugs with Drug Dealers at Streets
- Hitman Bounty System
- Ammunations, Pizza Stacks, Burger-Shots, Banks
- Jobs (Pizza-Boy, Plumber, Trasher, Bus)
- Money-Bag every 30 minutes
- Reaction Test every 15 minutes
- Daily improving by adding new features and fixing present bugs.
WalkZ is offline   Reply With Quote
Old 20/10/2019, 06:25 PM   #6
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

- So how to display the message when entering or leaving the safe area?
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 20/10/2019, 07:09 PM   #7
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 319
Reputation: 12
Default Re: Show Notifications [Come in/Get out] Safezone

Quote:
Originally Posted by KensPTV View Post
- So how to display the message when entering or leaving the safe area?
Under
Code:
public OnPlayerLeaveDynamicArea(playerid, areaid)
You should do something like:

Code:
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
SendClientMessage(playerid, -1, "Leaving safe zone");

return 1;
}
And then the same for the OnPlayerEnterDynamicArea. I'm not familiar with the two functions as such, but it should do the trick.
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 21/10/2019, 03:14 PM   #8
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 Proxus View Post
Under
Code:
public OnPlayerLeaveDynamicArea(playerid, areaid)
You should do something like:

Code:
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
SendClientMessage(playerid, -1, "Leaving safe zone");

return 1;
}
And then the same for the OnPlayerEnterDynamicArea. I'm not familiar with the two functions as such, but it should do the trick.
- Heyy, I added that code successfully, but the game doesn't show a chatlog message
__________________
Kens.P TV @ Youtuber
Scripting @ Samp
Adminstrator @ Designer @ [KG:RP]
KensPTV is offline   Reply With Quote
Old 21/10/2019, 03:29 PM   #9
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 374
Reputation: 87
Default Re: Show Notifications [Come in/Get out] Safezone

Quote:
Originally Posted by KensPTV View Post
- Heyy, I added that code successfully, but the game doesn't show a chatlog message
Did you create the areas? and did you load streamer?
__________________
Lokii is offline   Reply With Quote
Old 21/10/2019, 03:31 PM   #10
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

- Yess. But it don’t show message.
- Can you guide me more specifically?
__________________
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 02:34 PM.


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