Raised This Month: $ Target: $400
 0% 

Const reading problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Estland
Member
Join Date: Nov 2012
Old 12-11-2014 , 10:28   Const reading problem
Reply With Quote #1

Code:
#include <amxmodx>

new const g_maps[][] =
{
   "de_inferno",
   "de_dust2"
}

public plugin_init(){
   register_plugin("Drop Awp","0.3","Faval")
   register_event("WeapPickup","Kontroll","b","1=18")
   return PLUGIN_CONTINUE
}

public Kontroll(id) {
   new map[32]
   get_mapname(map, 31)
   for(new i=0;i< sizeof(g_maps);i++)
   {
      if(equal(map, g_maps[i]))
      {
         return PLUGIN_CONTINUE
      }
      new llama = read_data(0)
      client_print(llama,print_center,"AWP pole lubatud.")
      engclient_cmd(llama, "drop","weapon_awp")
      client_cmd(llama,"drop weapon_awp")
      return PLUGIN_CONTINUE
   }
   return PLUGIN_HANDLED
}
My problem is that it reads the first map fine, but mapnames after that aren't read by the plugin.
Estland is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2014 , 10:43   Re: Const reading problem
Reply With Quote #2

Code:
#include <amxmodx> new const g_maps[][] = {    "de_inferno",    "de_dust2" } public plugin_init(){    register_plugin("Drop Awp","0.3","Faval")    register_event("WeapPickup","Kontroll","b","1=18") } public Kontroll(id) {    new map[32]    get_mapname(map, charsmax(map))    for(new i=0;i< sizeof g_maps;i++)    {       if(equal(map, g_maps[i]))       {          continue       }       new llama = read_data(0)       client_print(llama,print_center,"AWP pole lubatud.")       engclient_cmd(llama, "drop","weapon_awp")       client_cmd(llama,"drop weapon_awp")    } }
You should learn how to use and when to use return.
__________________

Last edited by HamletEagle; 12-11-2014 at 10:47.
HamletEagle is offline
Estland
Member
Join Date: Nov 2012
Old 12-11-2014 , 12:34   Re: Const reading problem
Reply With Quote #3

Now it doesn't work at all. If map is included in g_maps list, then I want the player to be able to pick up the AWP.
Estland is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 12-11-2014 , 13:11   Re: Const reading problem
Reply With Quote #4

Quote:
Originally Posted by Estland View Post
Now it doesn't work at all. If map is included in g_maps list, then I want the player to be able to pick up the AWP.
why wont you just use the restmenu plugin that comes with amxx counter-strike addon pack?
jimaway is offline
Old 12-11-2014, 12:37
HamletEagle
This message has been deleted by HamletEagle.
Estland
Member
Join Date: Nov 2012
Old 12-11-2014 , 14:17   Re: Const reading problem
Reply With Quote #6

User wants to control restriction through this plugin's sma.

It still works only with the first map. Why? :/
Estland is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2014 , 14:25   Re: Const reading problem
Reply With Quote #7

Now I think that I understood what you need.

Code:
#include <amxmodx> new const g_maps[][] = {     "de_inferno",     "de_dust2" } new bool: AllowOnThisMap public plugin_init(){     register_plugin("Drop Awp","0.3","Faval")         new map[32]     get_mapname(map, charsmax(map))     for(new i=0;i< sizeof g_maps;i++)     {         if(equal(map, g_maps[i]))         {             AllowOnThisMap = true             break         }     }     if(!AllowOnThisMap)     {         register_event("WeapPickup","Kontroll","b","1=18")     }     else     {         pause("a")     } } public Kontroll(id) {     new llama = read_data(0)     client_print(llama,print_center,"AWP pole lubatud.")     engclient_cmd(llama, "drop","weapon_awp")     client_cmd(llama,"drop weapon_awp") }
__________________

Last edited by HamletEagle; 12-11-2014 at 14:26.
HamletEagle is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 15:31.


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