SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 05/08/2010, 06:42 AM   #1
Kevin_Joshen
Huge Clucker
 
Kevin_Joshen's Avatar
 
Join Date: Jul 2010
Posts: 320
Reputation: 0
Default Parameters for a DM?

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!
__________________


Check out the Forums!



Banner made by Zh3R0
Kevin_Joshen is offline  
Old 05/08/2010, 06:50 AM   #2
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,268
Reputation: 105
Default Re: Parameters for a DM?

You can just reset his weapons.
pawn Code:
ResetPlayerWeapons(playerid); //Under OnPlayerCommandText
__________________
[MWR]Blood is offline  
Old 05/08/2010, 06:51 AM   #3
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: Parameters for a DM?

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.
Carlton is offline  
Old 05/08/2010, 06:54 AM   #4
Kevin_Joshen
Huge Clucker
 
Kevin_Joshen's Avatar
 
Join Date: Jul 2010
Posts: 320
Reputation: 0
Default Re: Parameters for a DM?

[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...
__________________


Check out the Forums!



Banner made by Zh3R0
Kevin_Joshen is offline  
Old 05/08/2010, 07:14 AM   #5
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: Parameters for a DM?

@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
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline  
Old 05/08/2010, 07:16 AM   #6
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: Parameters for a DM?

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.
Carlton is offline  
Old 05/08/2010, 07:22 AM   #7
Kevin_Joshen
Huge Clucker
 
Kevin_Joshen's Avatar
 
Join Date: Jul 2010
Posts: 320
Reputation: 0
Default Re: Parameters for a DM?

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?
__________________


Check out the Forums!



Banner made by Zh3R0
Kevin_Joshen is offline  
Old 05/08/2010, 07:23 AM   #8
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,304
Reputation: 2184
Default Re: Parameters for a DM?

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.
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline  
Old 05/08/2010, 07:27 AM   #9
Kevin_Joshen
Huge Clucker
 
Kevin_Joshen's Avatar
 
Join Date: Jul 2010
Posts: 320
Reputation: 0
Default Re: Parameters for a DM?

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)
__________________


Check out the Forums!



Banner made by Zh3R0
Kevin_Joshen is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help: Parameters and such. Kevin_Joshen Help Archive 6 27/07/2010 01:00 AM
Optional parameters? Gozerr Help Archive 1 27/02/2010 02:21 PM
Referenced parameters? yom Plugin Development 15 22/11/2009 06:41 PM
Optional Parameters Dreftas Help Archive 1 11/10/2009 11:34 AM
Object Parameters SimonXY Help Archive 2 31/05/2009 05:40 PM


All times are GMT. The time now is 06:06 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.