Parameters for a DM?
#1

Quote:

now i have the following issue....


Any player can just type /minigundm and when they go there they get a minigun..... then they type /lvair and now they have a minigun in the LVAirport.... how do i take the players weapon upon exiting the dm area?

Is there a way to set a paremeter around the dm area and when he exits the area he looses the minigun?

this is from another question i had... but its not really related to that thread.. so i made this one for this question. PLEASE HELP ME! Thank you!
Reply
#2

You can just reset his weapons.
pawn Code:
ResetPlayerWeapons(playerid); //Under OnPlayerCommandText
Reply
#3

pawn Code:
RemovePlayerWeapon(playerid, weaponid)
{
    if(!IsPlayerConnected(playerid) || weaponid < 0 || weaponid > 50)
        return;

    new
        saveweapon[13],
        saveammo[13];

    // Probably could be done using one loop
    for(new slot = 0; slot < 13; slot++)
        GetPlayerWeaponData(playerid, slot, saveweapon[slot], saveammo[slot]);

    ResetPlayerWeapons(playerid);

    for(new slot; slot < 13; slot++)
    {
        if(saveweapon[slot] == weaponid || saveammo[slot] == 0)
            continue;

        GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]);
    }

    // give them weapon ID 0 to reset the current armed weapon
    // to a fist and not the last weapon in their inventory
    GivePlayerWeapon(playerid, 0, 1);

}
Example:

pawn Code:
RemovePlayerWeapon(playerid, 38); // Removes the Minigun.
Reply
#4

[QUOTE=Carlton;778990]
pawn Code:
RemovePlayerWeapon(playerid, weaponid)
{
    if(!IsPlayerConnected(playerid) || weaponid < 0 || weaponid > 50)
        return;

    new
        saveweapon[13],
        saveammo[13];

    // Probably could be done using one loop
    for(new slot = 0; slot < 13; slot++)
        GetPlayerWeaponData(playerid, slot, saveweapon[slot], saveammo[slot]);

    ResetPlayerWeapons(playerid);

    for(new slot; slot < 13; slot++)
    {
        if(saveweapon[slot] == weaponid || saveammo[slot] == 0)
            continue;

        GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]);
    }

    // give them weapon ID 0 to reset the current armed weapon
    // to a fist and not the last weapon in their inventory
    GivePlayerWeapon(playerid, 0, 1);

}


Thank you! so where should i put the coding? (the first one is the one i must use right?) also, i have several different DM's. like /m4dm so when a player tp's away from /m4dm (lets just say to /lsair) i just paste the above coding in the TP command? im sorry i dont understand...
Reply
#5

@Carlton: Doesn't this gives the double amount of what he's already holding? (GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]) < Supposed to be a positive number?)
Also, I suggest you to break the loop once you find the weapon you need to remove :P
Reply
#6

Quote:
Originally Posted by Hiddos
View Post
@Carlton: Doesn't this gives the double amount of what he's already holding? (GivePlayerWeapon(playerid, saveweapon[slot], saveammo[slot]) < Supposed to be a positive number?)
Also, I suggest you to break the loop once you find the weapon you need to remove :P
No, I didn't create the function, i've used it many times in the past, and have had no problems what-so-ever.
Reply
#7

ok.... i think this method might work.. (found it on the wiki) but i still need help on how to use it right:

IsPlayerInRangeOfPoint

and

GetPlayerPos


i'm thinking that somehow i could get the players position.... then if he is in range of the center of the minigun dm then he can keep his minigun.. if he is out of the range (tp's away for instance) then he looses his minigun.


This would enable him to keep his other weapons, but strictly lose his minigun. right? so how do i make this work?
Reply
#8

Quote:
Originally Posted by Carlton
View Post
No, I didn't create the function, i've used it many times in the past, and have had no problems what-so-ever.
Oh well nevermind, didn't saw that double loop.
Reply
#9

Quote:
Originally Posted by Hiddos
View Post
Oh well nevermind, didn't saw that double loop.

what do you think of my idea? (posted just above your last post)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)