AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Im stuck (https://forums.alliedmods.net/showthread.php?t=28748)

SuperDuper 05-21-2006 19:58

Im stuck
 
Im trying to make a plugin where when you activate it, everyone has crazy health, speed, armor and gravity. but now i am stuck and dont know how to finish. can anyone help?

Code:
#include <amxmodx>   #include <amxmisc>   #include <fun>   #include <engine> #include <cstrike> #define PLUGIN "Epic"   #define VERSION "1.0"   #define AUTHOR "SuperDuper" public plugin_init()     {       register_plugin(PLUGIN, VERSION, AUTHOR)             register_clcmd("amx_epicon", "cmd_epicon")     register_clcmd("amx_epicoff", "cmd_epicoff") } public cmd_epicon(id, level, cid) {     if (!cmd_access(id, level, cid, 1))               return PLUGIN_HANDLED                   set_user_footsteps (id, 1)       set_user_health(id, 5000)     set_user_gravity (id, 0.20)     set_user_maxspeed (id, -3.0)     set_user_armor (id, 5000)   }   public cmd_epicoff(id, level, cid) {     if (!cmd_access(id, level, cid, 0))             return PLUGIN_HANDLED                 set_user_fottsteps (id, 0)     set_user_health(id, 100)            set_user_gravity(id, 1.0)     set_user_maxspeed(id, 1.0)      set_user_armor(id, 100) }

thans...

Peli 05-21-2006 20:00

What are you stuck on? Give us clues.

SuperDuper 05-21-2006 20:01

it says that cmd_epicon and cmd_epicoff must return a variable. + i dont know how to end it. Im new at coding :P

Hawk552 05-21-2006 20:04

If you want it to work after round ends, it'll involve a lot more work:

Code:
#include <amxmodx>   #include <amxmisc>   #include <fun>   #include <engine> #include <cstrike> #define PLUGIN "Epic"   #define VERSION "1.0"   #define AUTHOR "SuperDuper" public plugin_init()     {       register_plugin(PLUGIN, VERSION, AUTHOR)           register_clcmd("amx_epicon", "cmd_epicon")     register_clcmd("amx_epicoff", "cmd_epicoff") } public cmd_epicon(id, level, cid) {     if (!cmd_access(id, level, cid, 1))           return PLUGIN_HANDLED         new iPlayers[32],iPlayersnum,iPlayer     get_players(iPlayers,iPlayersnum,"a")         for(new iCount = 0;iCount < iPlayersnum;iCount++)     {         iPlayer = iPlayers[iCount]         set_user_footsteps (iPlayer, 1)           set_user_health(iPlayer, 5000)         set_user_gravity (iPlayer, 0.20)         set_user_maxspeed (iPlayer, -3.0)         set_user_armor (iPlayer, 5000)       }         client_print(0,print_chat,"[AMXX] Epic has been enabled.")         return PLUGIN_HANDLED }   public cmd_epicoff(id, level, cid) {     if (!cmd_access(id, level, cid, 0))         return PLUGIN_HANDLED             new iPlayers[32],iPlayersnum,iPlayer     get_players(iPlayers,iPlayersnum,"a")         for(new iCount = 0;iCount < iPlayersnum;iCount++)     {         iPlayer = iPlayers[iCount]         set_user_footsteps (iPlayer, 0)           set_user_health(iPlayer, 100)         set_user_gravity (iPlayer, 1.0)         set_user_maxspeed (iPlayer, 1.0)         set_user_armor (iPlayer, 100)       }         client_print(0,print_chat,"[AMXX] Epic has been disabled.")         return PLUGIN_HANDLED }

SuperDuper 05-21-2006 20:06

i dont know how you do that so fast, your my hero :shock: :D :D

Hawk552 05-21-2006 20:06

Quote:

Originally Posted by SuperDuper
i dont know how you do that so fast, your my hero :shock: :D :D

Practice makes perfect.

SuperDuper 05-21-2006 20:07

what if i made a cvar command, like epicmod "0" 1". then wouldnt it stay on after each round???

Peli 05-21-2006 20:08

Yes, and you could control it to active/deactive and check/uncheck on functions if an admin turns it on/off.

SuperDuper 05-21-2006 20:11

how would t hat work? is nt that a very advacned code?!

Hawk552 05-21-2006 20:13

:arrow:

EDIT: as it stands, this will fuck with anything else that changes gravity, health etc

Code:
#include <amxmodx>   #include <amxmisc>   #include <fun>   #include <engine> #include <cstrike> #define PLUGIN "Epic"   #define VERSION "1.0"   #define AUTHOR "SuperDuper" new bool:g_bEpicEnabled public plugin_init()     {       register_plugin(PLUGIN, VERSION, AUTHOR)           register_clcmd("amx_epicon", "cmd_epicon")     register_clcmd("amx_epicoff", "cmd_epicoff")         register_event("ResetHUD","fnEventResetHUD","be")     register_event("CurWeapon","fnEventCurWeapon","be") } public cmd_epicon(id, level, cid) {     if (!cmd_access(id, level, cid, 1))           return PLUGIN_HANDLED         new iPlayers[32],iPlayersnum     get_players(iPlayers,iPlayersnum,"a")         g_bEpicEnabled = true         for(new iCount = 0;iCount < iPlayersnum;iCount++)         fnEventResetHUD(iPlayers[iCount])         client_print(0,print_chat,"[AMXX] Epic has been enabled.")         return PLUGIN_HANDLED }   public cmd_epicoff(id, level, cid) {     if (!cmd_access(id, level, cid, 0))         return PLUGIN_HANDLED             new iPlayers[32],iPlayersnum     get_players(iPlayers,iPlayersnum,"a")         g_bEpicEnabled = false         for(new iCount = 0;iCount < iPlayersnum;iCount++)         fnEventResetHUD(iPlayers[iCount])         client_print(0,print_chat,"[AMXX] Epic has been disabled.")         return PLUGIN_HANDLED } public fnEventResetHUD(id)     if(g_bEpicEnabled)     {         set_user_footsteps (id, 1)           set_user_health(id, 5000)         set_user_gravity (id, 0.20)         set_user_armor (id, 5000)       }     else     {         set_user_footsteps (id, 0)           set_user_health(id, 100)         set_user_gravity (id, 1.0)         set_user_armor (id, 100)       } public fnEventCurWeapon(id)     if(g_bEpicEnabled)         set_user_maxspeed(id,-3.0)


All times are GMT -4. The time now is 16:24.

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