SA-MP Forums Archive
How to create a weapon only zone? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to create a weapon only zone? (/showthread.php?tid=237755)



How to create a weapon only zone? - Gemini - 10.03.2011

/imageshack/i/samp001dx.png/

Ive been working on this Rocket Deathmath, there is 1 ship, and 1 dock. The players have to only use rocket launcers and kill the other players, in between the ship and the dock im working on a moving container.
How do I create a zone, that players can only use rocketlaunchers here? and not spawn other weopons or health. And how do i make it , that you can only have weapons in this zone, and when you teleport to somewhere else, you'll lose the weapons? I dont want players to have weapons on spawn, for example.


Re: How to create a weapon only zone? - Riddick94 - 10.03.2011

pawn Код:
#include <a_samp>

new PlayerInRocketDM[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(PlayerInRocketDM[playerid])
    {
        if(GetPlayerWeapon(playerid) != WEAPON_ROCKETLAUNCHER)
        {
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 200);
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}
Better change OnPlayerUpdate to SetTimer/Ex.


Re: How to create a weapon only zone? - Gemini - 10.03.2011

But how does the script know when the player is in RocketDm?


Re: How to create a weapon only zone? - Riddick94 - 10.03.2011

You've a command to teleport? if yes.. just put this in command:
pawn Код:
PlayerInRocketDM[playerid] = 1;



Re: How to create a weapon only zone? - XFlawless - 10.03.2011

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
pawn Код:
#include <a_samp>

new PlayerInRocketDM[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(PlayerInRocketDM[playerid])
    {
        if(GetPlayerWeapon(playerid) != WEAPON_ROCKETLAUNCHER)
        {
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 200);
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInRocketDM[playerid] = 0;
    return 1;
}
Better change OnPlayerUpdate to SetTimer/Ex.
Missing main parts ?

Check this.


Re: How to create a weapon only zone? - Riddick94 - 10.03.2011

IsPlayerInArea only when player leave that area. I lost about that.


Re: How to create a weapon only zone? - XFlawless - 10.03.2011

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
IsPlayerInArea only when player leave that area. I lost about that.
No it checks if that player is in that area when it's used with a timer. Read it again.


Re: How to create a weapon only zone? - Mean - 10.03.2011

Quote:
Originally Posted by Meyer
Посмотреть сообщение
No it checks if that player is in that area when it's used with a timer. Read it again.
Can't you see he checks with the variable, not with area?