How do I make this? -
Gemini - 18.05.2011
I want to make a deathmatch zone, but I don't want players to have weapons anywhere outside that deathmatch zone. So if a player, for example, teleports to /chainsawmatch, he will be teleported to the chainsaw deathmatch, and automatically gets a chainsaw. But when he drives/flys/teleports to somewhere else, that chainsaw will be gone.
How can I create this?
Re: How do I make this? -
Zh3r0 - 18.05.2011
Use IsPlayerInArea (A custom function made by someone).
Re: How do I make this? -
MadeMan - 18.05.2011
Use this function
https://sampwiki.blast.hk/wiki/ResetPlayerWeapons
Re: How do I make this? -
Gemini - 18.05.2011
So... I got the IsPlayerInArea. So what I do now? if player is not in area, then disable weapons?
What if i want to make multiple deathmath zones, each with different weapons.
Re: How do I make this? -
MadeMan - 18.05.2011
When player is teleporting, reset weapons and give new weapons (or don't give at all if player left the DM zone).
Re: How do I make this? -
Gemini - 18.05.2011
Now im encountering 2 problems, im using this:
PHP код:
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301)
{
GivePlayerWeapon(i, 26, 500);
}
else
{
ResetPlayerWeapons(i);
}
}
}
with a timer SetTimer("isPlayerInArea", 1000, 1);
What I want is, to allow weapons in MULTIPLE areas. So how do I add in another area where weapons wont be reset?
And second, because of the timer that checks every 1 second, the weapon (in this case id 26 sawn off shotgun) gets 500 bullets every 1 second. I don't want this to happen. How can I make that possible? If I remove the timer, the 'isplayerinarea' check doesn't work.
Re: How do I make this? -
MadeMan - 18.05.2011
pawn Код:
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301) // area 1
{
}
else if (X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301) // area 2
{
}
else
{
ResetPlayerWeapons(i);
}
}
}
And don't give weapons in this timer, but in the command that teleports player.
Re: How do I make this? -
Zh3r0 - 18.05.2011
For multiple areas:
pawn Код:
if (X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301 || X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301 || X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301 || X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301 || X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301)
Use ||.
Simple, Remove then give again, on and on.
Re: How do I make this? -
Gemini - 18.05.2011
Great! Thanks guys I did it