Raised This Month: $ Target: $400
 0% 

Wont give any nades.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-05-2012 , 12:46   Wont give any nades.
Reply With Quote #1

Hello there,

I tryed to make a dodgeball game, but this set_task wont give any he nades. Why wont it?


PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#include <fakemeta>

#define PLUGIN "Dodgeball"
#define VERSION "1.0"
#define AUTHOR "Bilal"

new const Prefix[] = "[sG]"

new dodgeball[] = "models/sgknife/v_dodgeball.mdl";
new 
dodgeball2[] = "models/sgknife/p_dodgeball.mdl";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""CmdDodgeball")
}

public 
plugin_precache()
{
    
precache_model(dodgeball)
    
precache_model(dodgeball2)
}

public 
CmdDodgeball(id)
{
    new 
menu menu_create("Game:""MenuHandler")
    
    
menu_additem(menu"Dodgeball""1")
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
MenuHandler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], szName[64], accescallback
    menu_item_getinfo
(menuitemaccesdatacharsmax(data), szNamecharsmax(szName), callback)
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1CmdDodgeball2(id)
        }
    return 
PLUGIN_HANDLED
}

public 
CmdDodgeball2(id)
{
    new 
name[32], players[32], iNum
    get_user_name
(idname31)
    
get_players(playersiNum"ch")
    
    for (new 
i<iNumi++)
    {
        
strip_user_weapons(players[i])
        
give_item(players[i], "weapon_hegrenade")
        
CmdDodgeball3(players[i])
        
set_pev(players[i], pev_viewmodel2dodgeball)
        
set_pev(players[i], pev_weaponmodel2dodgeball2)
    }
    
    
ColorChat(idGREY"%s ^4%s^1 has started the day: ^4Dodgeball"Prefixname)
}

public 
CmdDodgeball3(id)
{
    
set_task(0.5"GiveBalls"100_,_"b")
}

public 
GiveBalls(id)
{
    new 
players[32], iNum
    get_players
(playersiNum"a")
    
    for (new 
i<iNumi++)
    {
        if (!
is_user_alive(players[i]))
        {
            return 
PLUGIN_HANDLED
        
}
        if (!(
get_user_weapon(players[i]) == CSW_HEGRENADE))
        {
            
give_item(players[i], "weapon_hegrenade")
        }
    }
    return 
PLUGIN_CONTINUE

__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.

Last edited by Bilal Pro; 05-05-2012 at 12:53.
Bilal Pro is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-05-2012 , 12:52   Re: Wont give any nades.
Reply With Quote #2

PHP Code:
if( !user_has_weaponiPlayerCSW_HEGRENADE ) )
{
  
//

Don't use return in loops, use only continue and break
Please search more informations about loop statements.
__________________

Last edited by claudiuhks; 05-05-2012 at 12:54.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-05-2012 , 12:56   Re: Wont give any nades.
Reply With Quote #3

Make the task in plugin_init or better use a thinking entity.
__________________
<VeCo> is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-05-2012 , 13:00   Re: Wont give any nades.
Reply With Quote #4

Now i have tryed this

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#include <fakemeta>

#define PLUGIN "Dodgeball"
#define VERSION "1.0"
#define AUTHOR "Bilal"

new const Prefix[] = "[sG]"

new dodgeball[] = "models/sgknife/v_dodgeball.mdl";
new 
dodgeball2[] = "models/sgknife/p_dodgeball.mdl";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""CmdDodgeball")
}

public 
plugin_precache()
{
    
precache_model(dodgeball)
    
precache_model(dodgeball2)
}

public 
CmdDodgeball(id)
{
    new 
menu menu_create("Game:""MenuHandler")
    
    
menu_additem(menu"Dodgeball""1")
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
MenuHandler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], szName[64], accescallback
    menu_item_getinfo
(menuitemaccesdatacharsmax(data), szNamecharsmax(szName), callback)
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1CmdDodgeball2(id)
        }
    return 
PLUGIN_HANDLED
}

public 
CmdDodgeball2(id)
{
    new 
name[32], players[32], iNum
    get_user_name
(idname31)
    
get_players(playersiNum"ch")
    
    for (new 
i<iNumi++)
    {
        
strip_user_weapons(players[i])
        
give_item(players[i], "weapon_hegrenade")
        
set_task(2.0"GiveBalls"players[i], _,_"b")
        
set_pev(players[i], pev_viewmodel2dodgeball)
        
set_pev(players[i], pev_weaponmodel2dodgeball2)
    }
    
    
ColorChat(idGREY"%s ^4%s^1 has started the day: ^4Dodgeball"Prefixname)
}

public 
GiveBalls(id)
{
    if (
is_user_alive(id))
    {
        
give_item(id"weapon_hegrenade")
    }

But it still doesnt work, wont give the he nades.
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.

Last edited by Bilal Pro; 05-05-2012 at 13:02.
Bilal Pro is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-05-2012 , 13:09   Re: Wont give any nades.
Reply With Quote #5

Now i am camping with a new problem,

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#include <fakemeta>

#define PLUGIN "Dodgeball"
#define VERSION "1.0"
#define AUTHOR "Bilal"

new const Prefix[] = "[sG]"

new dodgeball[] = "models/sgknife/v_dodgeball.mdl";
new 
dodgeball2[] = "models/sgknife/p_dodgeball.mdl";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Knifemodel""b""1=1")
    
    
register_clcmd("say /menu""CmdDodgeball")
}

public 
plugin_precache()
{
    
precache_model(dodgeball)
    
precache_model(dodgeball2)
}

public 
CmdDodgeball(id)
{
    new 
menu menu_create("Game:""MenuHandler")
    
    
menu_additem(menu"Dodgeball""1")
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
MenuHandler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], szName[64], accescallback
    menu_item_getinfo
(menuitemaccesdatacharsmax(data), szNamecharsmax(szName), callback)
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1CmdDodgeball2(id)
        }
    return 
PLUGIN_HANDLED
}

public 
CmdDodgeball2(id)
{
    new 
name[32], players[32], iNum
    get_user_name
(idname31)
    
get_players(playersiNum"ch")
    
    for (new 
i<iNumi++)
    {
        
strip_user_weapons(players[i])
        
give_item(players[i], "weapon_hegrenade")
        
set_task(2.0"GiveBalls"players[i], _,_"b")
        
set_pev(players[i], pev_viewmodel2dodgeball)
        
set_pev(players[i], pev_weaponmodel2dodgeball2)
    }
    
    
ColorChat(idGREY"%s ^4%s^1 has started the day: ^4Dodgeball"Prefixname)
}

public 
GiveBalls(id)
{
    if (
is_user_alive(id))
    {
        
give_item(id"weapon_hegrenade")
    }
}

public 
Knifemodel(id)
{
    if (
get_user_weapon(id) == CSW_HEGRENADE)
    {
        
set_pev(idpev_viewmodel2dodgeball)
        
set_pev(idpev_weaponmodel2dodgeball2)
    }

The first he which is given is shown as the model i wanted, but after i throw it away i get a new one ofcourse but i wont see the model of it
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-05-2012 , 13:13   Re: Wont give any nades.
Reply With Quote #6

Nvm, Solved. Trash this please
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 05-05-2012 , 15:18   Re: Wont give any nades.
Reply With Quote #7

threads dont get thrashed , since other members could have a use for it
EpicMonkey is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-05-2012 , 16:23   Re: Wont give any nades.
Reply With Quote #8

Allright then
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 05-05-2012 , 17:40   Re: Wont give any nades.
Reply With Quote #9

btw: you could post your solution for the problem so others can learn from it.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-05-2012 , 18:30   Re: Wont give any nades.
Reply With Quote #10

Quote:
Originally Posted by mottzi View Post
btw: you could post your solution for the problem so others can learn from it.
please don't. your code is always trash.
Liverwiz is offline
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 00:24.


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