PDA

View Full Version : Vehicle zone


bigboy81
22/01/2015, 07:25 PM
I making system if vehicle enter in some zone server detect vechicleid and destroy it..
But if player in vehicle and if in zone server spam him message Please leave this place
i dont know why??

new carid = GetPlayerVehicleID(playerid);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(IsPlayerInVehicle(playerid,carid))
{
SCM(playerid, COLOR_RED,"{EA0C0C}Please leave this place !");
}
return 1;
}

Riso135
22/01/2015, 08:01 PM
If you want what you wrote, do this:

new carid = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(IsPlayerInVehicle(playerid,carid))
{
RemovePlayerFromVehicle(playerid);
DestroyVehicle(carid);
}

bigboy81
22/01/2015, 08:09 PM
I want that with text,but text spam in my code..

Riso135
22/01/2015, 08:16 PM
Than do it for example via textdraw or gametext, it spams SendClientMessage because the server is still checking if the player is in radius of that coordinates

bigboy81
22/01/2015, 08:26 PM
I know server use sendclientmessage but doesn't spawm..
Where to put that text and fix spamm?

Sawalha
22/01/2015, 08:27 PM
try to add break; inside the loop so it can prevent it from continuing

bigboy81
22/01/2015, 09:11 PM
not work

bigboy81
23/01/2015, 11:21 AM
FIRST BUMP !

bigboy81
23/01/2015, 07:32 PM
BUMP TWO !

bigboy81
23/01/2015, 08:41 PM
Anybody ???

Rodney Francalim
23/01/2015, 08:51 PM
You can use Incognito's Streamer (http://forum.sa-mp.com/showthread.php?t=102865).


#define MAX_AREAS (20) // How much that you want

new
NoVehAreas[MAX_AREAS]
;

public OnGameModeInit()
{
NoVehAreas[0] = CreateDynamicRectangle(0, 0, 500, 500);
return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(IsPlayerInAnyVehicle(playerid))
for(new i = 0; i < NoVehAreas; ++i)
if(NoVehAreas[i] == areaid)
DestroyVehicle(GetPlayerVehicleID(playerid));

return 1;
}

bigboy81
23/01/2015, 09:14 PM
Yes but how i can stop spam?
If player in zone i want server send him one message.
But if player in zone server spam to me message you are in zone..
How to stop that??

GGW
23/01/2015, 09:20 PM
Try To Use a Timer To Send The Message and make the Timer ( False ) so it don't repeat it self and send the message only one time like this

SetTimer("Message",1000, false);

click here (http://wiki.sa-mp.com/wiki/SetTimer) to See How To Use Timers

Matess
23/01/2015, 09:28 PM
?
new carid = GetPlayerVehicleID(playerid);
new inZone[MAX_PLAYERS];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(inZone[i]) continue;
if(IsPlayerInVehicle(i,carid))
{
SCM(i, COLOR_RED,"{EA0C0C}Please leave this place !");
inZone[i] = true;
}
return 1;
}
else
{
inZone[i] = false;
}

Rodney Francalim
23/01/2015, 09:34 PM
Yes but how i can stop spam?
If player in zone i want server send him one message.
But if player in zone server spam to me message you are in zone..
How to stop that??

Did you read my code?
#define MAX_AREAS (20) // How much that you want

new
NoVehAreas[MAX_AREAS]
;

public OnGameModeInit()
{
NoVehAreas[0] = CreateDynamicRectangle(0, 0, 500, 500);
return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(IsPlayerInAnyVehicle(playerid))
for(new i = 0; i < NoVehAreas; ++i)
if(NoVehAreas[i] == areaid)
{
SendClientMessage(playerid, -1, "You're in a forbidden zone.");
DestroyVehicle(GetPlayerVehicleID(playerid));
}

return 1;
}


@EDIT:
Use the Streamer: http://forum.sa-mp.com/showthread.php?t=102865

bigboy81
23/01/2015, 09:38 PM
Yes i read your code and i will try that now and i will answer you

bigboy81
23/01/2015, 10:10 PM
Try To Use a Timer To Send The Message and make the Timer ( False ) so it don't repeat it self and send the message only one time like this

SetTimer("Message",1000, false);

click here (http://wiki.sa-mp.com/wiki/SetTimer) to See How To Use Timers

Not work,spamm

bigboy81
23/01/2015, 10:20 PM
?
new carid = GetPlayerVehicleID(playerid);
new inZone[MAX_PLAYERS];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(inZone[i]) continue;
if(IsPlayerInVehicle(i,carid))
{
SCM(i, COLOR_RED,"{EA0C0C}Please leave this place !");
inZone[i] = true;
}
return 1;
}
else
{
inZone[i] = false;
}

Not work,spam if player around zone.
If in zone nothing happen..

Matess
23/01/2015, 10:25 PM
Where are you using it?

if vehicle enter in some zone server detect vechicleid and destroy it..
new carid = GetPlayerVehicleID(playerid);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(IsPlayerInVehicle(i,carid))
{
SCM(i, COLOR_RED,"{EA0C0C}Please leave this place !");
DestroyVehicle(carid);
}
return 1;
}

bigboy81
23/01/2015, 10:33 PM
I maped some pizza stack and car can enter into pizza stack..
I want block car that can't enter but i make everything good but only the text spam..

bigboy81
23/01/2015, 10:57 PM
Did you read my code?
#define MAX_AREAS (20) // How much that you want

new
NoVehAreas[MAX_AREAS]
;

public OnGameModeInit()
{
NoVehAreas[0] = CreateDynamicRectangle(0, 0, 500, 500);
return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(IsPlayerInAnyVehicle(playerid))
for(new i = 0; i < NoVehAreas; ++i)
if(NoVehAreas[i] == areaid)
{
SendClientMessage(playerid, -1, "You're in a forbidden zone.");
DestroyVehicle(GetPlayerVehicleID(playerid));
}

return 1;
}


@EDIT:
Use the Streamer: http://forum.sa-mp.com/showthread.php?t=102865

This work,but if player too long from zone server destroyed him car..

Banana_Ghost
23/01/2015, 11:37 PM
by using your code you posted, you could do something like this:


new carid = GetPlayerVehicleID(playerid);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189))
{
if(IsPlayerInVehicle(playerid,carid))
{
if(!GetPVarInt(playerid,"forbiddenzone"))
{
SCM(playerid, COLOR_RED,"{EA0C0C}Please leave this place !");
SetPVarInt(playerid,"forbiddenzone",1);
}
}
else
{
if(GetPVarInt(playerid,"forbiddenzone"))
{
DeletePVar(playerid,"forbiddenzone");
}
}
}
return 1;
}

If the player doesn't have a pvar on them when they enter the area, the server will set one and send them the message, the pvar is there to prevent spam, when they exit the area, if they have a pvar, it will be deleted, so when the player re-enters the area, they will get the message again.

Zume
23/01/2015, 11:47 PM
No ..

new
_v[MAX_PLAYERS]
;

forward Timer(); public Timer()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(_v[i] > gettime())
continue;

if(!IsPlayerInRangeOfPoint(i, 4.0, 1296.2551,-1863.5883,14.5189) || !IsPlayerInAnyVehicle(i))
continue;

SCM(i, COLOR_RED,"{EA0C0C}Please leave this place !");
_v[i] = gettime() + 5;
return 1;
}
}

HeLiOn_PrImE
24/01/2015, 12:24 AM
You are only allowed to bump once every 24 hours. Stop it or you might get warnings!