Raised This Month: $ Target: $400
 0% 

Voting/Weapon drop help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-01-2005 , 07:25   Voting/Weapon drop help
Reply With Quote #1

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
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 07:31  
Reply With Quote #2

Look at one of the plugins that can do voting.

strip_user_weapons() [ in Fun ] will probably also be your friend.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-01-2005 , 07:43  
Reply With Quote #3

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
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 07:46  
Reply With Quote #4

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.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-01-2005 , 07:55  
Reply With Quote #5

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
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 16:17  
Reply With Quote #6

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.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-01-2005 , 21:41  
Reply With Quote #7

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
}
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 21:53  
Reply With Quote #8

Slightly optimized

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
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-01-2005 , 22:19  
Reply With Quote #9

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
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-01-2005 , 22:21  
Reply With Quote #10

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
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Reply



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

Forum Jump


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


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