Raised This Month: $ Target: $400
 0% 

code to type in to give things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 03-12-2005 , 05:24   code to type in to give things
Reply With Quote #1

i'm trying to make a plugin.

at the start of the round, i want it to give all players that are alive a Flashbang, Smoke Nade, HE grenade. then when the player throws it, another of the grenade will be given to him 3 seconds later.

anyone can gimmi the code to do that?

thx in advance.
n0obie4life is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-12-2005 , 08:55  
Reply With Quote #2

Code:
#include <amxmodx> #include <fun> #include <cstrike> public plugin_init() {     register_plugin("Grenades","Version","n00bie")     register_cvar("amxx_grenades","1")     register_event("ResetHUD","iResethud","b")     return PLUGIN_CONTINUE } public iResethud(id) {    if(is_user_connected(id))    {       set_task(0.1,"grenades",id)    } } public grenades(id) {    if(is_user_alive(id))   {       give_item(id,"weapon_flashbang")       give_item(id,"weapon_smokegrenade")       give_item(id,"weapon_hegrenade")       set_task(3.0,"grenades",b)    } return PLUGIN_HANDLED }

Try this - this thing on every spawn gives you a grenade, and loops it every 1 second.
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 03-12-2005 , 09:36  
Reply With Quote #3

it doesn't work. i dropped the whole ting into my current plugin. can't compile.

its suppose to do /votegrenades.
n0obie4life is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 03-12-2005 , 12:41  
Reply With Quote #4

Ok, I'll try, wait a minute...
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 03-12-2005 , 13:07   here it is
Reply With Quote #5

Heres the plugin you want:

Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Plugin Name", "0.1", "author")     register_logevent("event_RoundStart", 2, "0=World triggered", "1=Round_Start")     register_event("TextMsg","event_GrenadeThrow","b","2&#Game_radio","4&#Fire_in_the_hole") } public event_RoundStart() {     for(new p = 0; p < 32; p++) {         if(is_user_alive(p)) {             give_item(p, "weapon_hegrenade")             give_item(p, "weapon_flashbang")             give_item(p, "weapon_smokegrenade")         }     }     return PLUGIN_HANDLED } public event_GrenadeThrow(id) {     new szModel[32]     new iGrenadeID     iGrenadeID = get_grenade(id)     if(iGrenadeID > 0) {         entity_get_string(iGrenadeID, EV_SZ_model, szModel, 32)         if(equali(szModel, "models/w_hegrenade.mdl"))             set_task(3.0, "task_NewHeGrenade", id)         else if(equali(szModel, "models/w_flashbang.mdl"))             set_task(3.0, "task_NewFlashbang", id)         else if(equali(szModel, "models/w_smokegrenade.mdl"))             set_task(3.0, "task_NewSmokeGrenade", id)     }     return PLUGIN_HANDLED } public task_NewHeGrenade(id) {     give_item(id, "weapon_hegrenade")     return PLUGIN_CONTINUE } public task_NewFlashbang(id) {     give_item(id, "weapon_flashbang")     return PLUGIN_CONTINUE } public task_NewSmokeGrenade(id) {     give_item(id, "weapon_smokegrenade")     return PLUGIN_CONTINUE }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 03-13-2005 , 01:28  
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #include <cstrike> new grenadesonly = 0 new choice[2] new votegrenadesonly[] = "\yGrenades Only?\w^n^n1. On^n2. Off" public plugin_init(){ register_plugin("Grenades Only","0.1","n0obie4life") register_concmd("amx_grenades","cmdgrenades",ADMIN_LEVEL_A,"- disable and enable grenades war 1 = on 0 = off") register_concmd("amx_votegrenades","cmdvotegrenades",ADMIN_VOTE,"- Starts a vote for grenades only") register_concmd("say /votegrenades","cmdvote",ADMIN_VOTE,"- start a vote to turn grenades only on or off") register_menucmd(register_menuid("\yGrenades Only?"),(1<<0)|(1<<1),"count_votes") register_event("CurWeapon","grenades","b") } public cmdgrenades(id){    new arg[2]    read_argv(1,arg,1)    set_hudmessage(200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2)    if(equal(arg,"1")){    grenadesonly = 1    client_cmd(id,"weapon_knife")    console_print(id,"Grenades Only has been turned on.")    show_hudmessage(0,"Grenades Only has been turned on.")    } else if(equal(arg,"0")){    grenadesonly = 0    console_print(id,"Grenades Only has been turned off.")    show_hudmessage(0,"Grenades Only has been turned off.")    } else {    if (grenadesonly==0){    console_print(id,"Usage: amx_grenades 1 = 0n 0 = off Currently: OFF")    }    if (grenadesonly==1){    console_print(id,"Usage: amx_grenades 1 = 0n 0 = off Currently: ON")    }    }    return PLUGIN_CONTINUE    } public grenades(id){         if(grenadesonly==0){             //nothing         }         if(grenadesonly==1){             new clip, ammo             new usersweapon = get_user_weapon(id,clip,ammo)             if(usersweapon == CSW_HEGRENADE || usersweapon == CSW_SMOKEGRENADE || usersweapon == CSW_FLASHBANG || usersweapon == CSW_KNIFE || usersweapon == CSW_C4) {                 //nothing             } else {                 client_cmd(id,"weapon_knife")             }         }         return PLUGIN_CONTINUE } public cmdvote(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()){         client_print(id,print_chat,"*A vote has already been cast.*")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"*Please wait awhile before you can vote again.*")         return PLUGIN_HANDLED     }     new menu_msg[256]     new name[32]     format(menu_msg,255,votegrenadesonly)     new Float:votetime = get_cvar_float("amx_vote_time") + 10.0     get_user_info(id, "name", name, 31)     set_cvar_float("amx_last_voting",  get_gametime() + votetime )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(votetime))     set_hudmessage(200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2)             show_hudmessage(0, "%s has started the Vote for Grenades Only",name)     set_task(votetime,"check_the_votes")     choice[0]=choice[1]=0     return PLUGIN_HANDLED     } public cmdvotegrenades(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()){         client_print(id,print_chat,"*A vote has already been cast.*")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"*Please wait awhile before you can vote again.*")         return PLUGIN_HANDLED     }     new menu_msg[256]     format(menu_msg,255,votegrenadesonly)     new Float:votetime = get_cvar_float("amx_vote_time") + 10.0     set_cvar_float("amx_last_voting",  get_gametime() + votetime )     show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(votetime))     set_task(votetime,"check_the_votes")     client_print(0,print_chat,"*Voting has started.*")     choice[0]=choice[1]=0     return PLUGIN_HANDLED     } public count_votes(id,key){     if (get_cvar_float("amx_vote_answers") ) {         new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"* %s voted %s", name, key ? "against grenades only" : "for grenades only" )     }     ++choice[key]     return PLUGIN_HANDLED } public check_the_votes(id){     if (choice[0] > choice[1]){         server_cmd("amx_grenades 1")         client_print(0,print_chat,"* Votes For Grenades Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])     } else {         server_cmd("amx_grenades 0")         client_print(0,print_chat,"* Votes Against Grenades Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])     }     return PLUGIN_CONTINUE }

i'll just place it here. please help me stuff in the code somewhere. i can't seem to do it.
n0obie4life 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 13:58.


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