How do I make this?
#1

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?
Reply
#2

Use IsPlayerInArea (A custom function made by someone).
Reply
#3

Use this function

https://sampwiki.blast.hk/wiki/ResetPlayerWeapons
Reply
#4

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.
Reply
#5

When player is teleporting, reset weapons and give new weapons (or don't give at all if player left the DM zone).
Reply
#6

Now im encountering 2 problems, im using this:

PHP код:
public isPlayerInArea()
   {
       new 
Float:XFloat:YFloat:Z
       for(new 
i=0MAX_PLAYERSi++) 
       {
           
GetPlayerPos(iXYZ); 
           if (
<= 2806.4766 && >= 2566.6860 && <= -2332.2461 && >= -2562.3301)
           {
               
GivePlayerWeapon(i26500); 
           }
           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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

Great! Thanks guys I did it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)