AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Voting/Weapon drop help (https://forums.alliedmods.net/showthread.php?t=20081)

semaja2 11-01-2005 07:25

Voting/Weapon drop help
 
Hey guys i thought i would try to learn amxx programming and have set a project for my self, The plugin allows a user/admin to call for a vote which requires 90% of people to vote yes other wise it fails

if the vote is yes, it strips all the weapons off the players and destoys the weapons, as well as prevents the users from buying weapons again

if the vote is not 90% yes then it cancles out and waits 5 mins before the vote can go again

PS. Try not to give the code away but if you can give me snippets or something to read on how i would write this, i have already read the basic guide on amxx help

Hawk552 11-01-2005 07:31

Look at one of the plugins that can do voting.

strip_user_weapons() [ in Fun ] will probably also be your friend.

semaja2 11-01-2005 07:43

thanks so much now i have somewhere to look but still need some help with the voting, is there a help file for it like there was for the fun module

Hawk552 11-01-2005 07:46

Just hit Search and then look for "voting" and other variants of it. You'll find tons of plugins that allow you to vote.

You can also open up adminvote.sma, which comes with AMXX.

semaja2 11-01-2005 07:55

hey man thanks heaps for all the help, its night time here but ill continue work tommorow

PS. i tried to add karma to you but for some reason i cant :S

Hawk552 11-01-2005 16:17

Np, if you need any help feel free to PM me, or post back here.

Also you need 10 posts (although I haven't check how many posts you have) to be able to effect karma.

semaja2 11-01-2005 21:41

Hey well i just thought i would make a simple strip weapon plugin first and add to it later

my code works in the compiler with a few warnings but i cant test it so can someone tell me if it works

Code:

//This makes it so you can use the core AMX Mod X functions
//It "includes" the native definitions from includes\amxmodx.inc
#include <amxmodx>
#include <fun>

//Declare three string variables
new PLUGIN[]="Knife Match"
new AUTHOR[]="semaja2"
new VERSION[]="0.01"

//This is a public function. 
//It is necessary to initialize your script under AMX Mod X.
//It takes no parameters, and is called right after map load.
public plugin_init()
{
    //This is a function that takes three strings.
    //It registers your function in AMX Mod X, and assigns some basic information.
    register_plugin(PLUGIN, VERSION, AUTHOR)
    //Sets cvars
    register_concmd("amx_knifematch", "amx_knifematch", ADMIN_SLAY, "NO DESCRIPTION")
}

public amx_knifematch(id, level, cid)
{
        new players[32], num
          //This function will fill the players[32] variable
          // with valid player ids.  num will contain the number
          // of players that are valid.
          get_players(players, num)
          new i
          for (i=0; i<num; i++)
          {
              strip_user_weapons (players[i])
          }

       
return PLUGIN_HANDLED
}


Hawk552 11-01-2005 21:53

Slightly optimized :wink:

Code:
//This makes it so you can use the core AMX Mod X functions //It "includes" the native definitions from includes\amxmodx.inc #include <amxmodx> #include <amxmisc> #include <fun> //Declare three string variables new PLUGIN[]="Knife Match" new AUTHOR[]="semaja2" new VERSION[]="0.01" //This is a public function. //It is necessary to initialize your script under AMX Mod X. //It takes no parameters, and is called right after map load. public plugin_init() {     //This is a function that takes three strings.     //It registers your function in AMX Mod X, and assigns some basic information.     register_plugin(PLUGIN, VERSION, AUTHOR)     //Sets cvars     register_concmd("amx_knifematch", "amx_knifematch", ADMIN_SLAY, "NO DESCRIPTION") } public amx_knifematch(id, level, cid) {     if(cmd_access(id,level,cid,1))         return 0         new num = get_maxplayers(), i         //This function will fill the players[32] variable     // with valid player ids.  num will contain the number     // of players that are valid.     for (i = 0; i <= num; i++)     {         strip_user_weapons(i)     }         return PLUGIN_HANDLED }

EDIT: If you want to see a complete knife plugin, although I'm not sure if it works, you can go here:

http://forums.alliedmods.net/showthread.php?t=20059

semaja2 11-01-2005 22:19

thanks for optimizing it, now i was wondering when the weapons drop do they disappear? and what module should i look through to disable the buy zone for the round

Hawk552 11-01-2005 22:21

strip_user_weapons simply removes their weapons, it doesn't make them drop it, and it isn't exploitable.

You should really just catch CurWeapon rather than EDIT: checking buyzones. read the link I gave you:

http://forums.alliedmods.net/showthread.php?t=20059


All times are GMT -4. The time now is 23:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.