AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   devil where are you? come help me again (https://forums.alliedmods.net/showthread.php?t=3016)

Poison_Jay 06-23-2004 21:45

devil where are you? come help me again
 
Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    register_plugin("Shield War","1","Poison_Jay");
    register_event("CurWeapon","shield","be","1=1")
    register_cvar("amx_shieldwar","1");
    return PLUGIN_CONTINUE;
}

public shield(id) {
        if(get_cvar_num("amx_shieldwar")==0)
                return PLUGIN_CONTINUE
                public shield(id) {
        if(get_cvar_num("amx_shieldwar")==1)
give_item(id,"weapon_shield") 
give_item(id,"weapon_deagle")
                give_item(id,"ammo_50ae")
                give_item(id,"ammo_50ae")
                give_item(id,"ammo_50ae")
                give_item(id,"ammo_50ae")
                give_item(id,"ammo_50ae")
               
}

This what i got when compiling....
Quote:

/home/users/amxmodx/tmp/phpZs98RB.sma(15) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpZs98RB.sma(15) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpZs98RB.sma(15) : error 001: expected token: ";", but found "{"
/home/users/amxmodx/tmp/phpZs98RB.sma(17) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(18) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpZs98RB.sma(18) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(19) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpZs98RB.sma(19) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(20) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(21) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(22) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(23) : error 017: undefined symbol "give_item"
/home/users/amxmodx/tmp/phpZs98RB.sma(25) : error 001: expected token: "}", but found "-end of file-"

10 Errors.

devicenull 06-23-2004 22:00

post code

Poison_Jay 06-23-2004 22:20

done, maybe u can also help me, my "frist time ever doing this" plugin seems abit...empty

devicenull 06-23-2004 22:27

First, plugin_init doesnt return a value
Second, stop using notepad, and start using actual tabs instead of spaces
Third, if statements need {} unless you just want to execute the next line
Fourth, give_item is in fun, so fun needs to be included, amxmisc isnt used so it doesnt need to be included
Fifth, use [ small] [ /small] when posting plugins
I fixed the code :)

Code:
#include <amxmodx> #include <fun> public plugin_init() {     register_plugin("Shield War","1","Poison_Jay");     register_event("CurWeapon","shield","be","1=1")     register_cvar("amx_shieldwar","1"); } public shield(id) {     if(get_cvar_num("amx_shieldwar")==0)         return PLUGIN_CONTINUE             if(get_cvar_num("amx_shieldwar")==1) {         give_item(id,"weapon_shield")         give_item(id,"weapon_deagle")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")     }     return PLUGIN_HANDLED }

Poison_Jay 06-23-2004 22:30

so that will work?

Code:
public shield(id) {     if(get_cvar_num("amx_shieldwar")==0)            return PLUGIN_CONTINUE                 if(get_cvar_num("amx_shieldwar")==1) {         give_item(id,"weapon_shield")         give_item(id,"weapon_deagle")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")         give_item(id,"ammo_50ae")

so if i amx_shieldwar 1, will everyone get a shield and deagle? looks like only the person -.-

and how to make it keep doing it every round

oh ya, i using JK editor

Mugwump 06-24-2004 11:06

There is an event you could map for new_rounds in your plugin_init so that you could supply that stuff every round. Something like this:

Code:

// Calls new_round at the start of each new round, put in plugin_init()
register_event("ResetHUD", "new_round", "b")

Then make a new_round function and add the code you had, but make it so everyone gets the stuff:

Code:

public new_round(id){
  new players[32], numofplayers

  get_players(players, numofplayers)

  // Iterate through all players and give shield and ammo
  for (new i=0; i<numofplayers; i++){ 
      if (get_cvar_num("amx_shieldwar")==1) {
        new pid = players[i]
        give_item(pid, "weapon_shield")
        give_item(pid, "weapon_deagle")
        give_item(pid, "ammo_50ae")
        give_item(pid, "ammo_50ae")
        give_item(pid, "ammo_50ae")
        give_item(pid, "ammo_50ae")
        give_item(pid, "ammo_50ae")
      }
  }

  return PLUGIN_CONTINUE
}


Poison_Jay 06-24-2004 11:28

Code:
/* AMXX Mod script. * * Shield War * Version Beta 1 * By: Poison_Jay * Special Thanks: Peli, Kingpin * * MSN: <a href="mailto:[email protected]">[email protected]</a> * * Commands: amx_shieldwar 1|0 * * Discription: All Players Spawn With Shield + Deagle */ #define TIME 5.0 #include <amxmodx> #include <fun> public plugin_init() {     register_plugin("Shield War","1","Poison_Jay");     register_event("CurWeapon","shield","be","1=1")     register_cvar("amx_shieldwar","1")     register_concmd("amx_shieldwar","amx_shieldwar",ADMIN_LEVEL_B,"1 = On 2 = Off") } public shield(id) {     if(get_cvar_num("amx_shieldwar")==0)            return PLUGIN_CONTINUE                     if(get_cvar_num("amx_shieldwar")==1) {         set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, TIME, 0.5, 1.5, 4 )         show_hudmessage(0, "ShieldWar mode has been enabled")         new clip, ammo         new usersweapon = get_user_weapon(id,clip,ammo)         client_cmd(id, "drop")         if(usersweapon==CSW_DEAGLE) {             give_item(id,"ammo_50ae")         } else {             set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, TIME, 0.5, 1.5, 4 )             show_hudmessage(0,"ShieldWar mode has been enabled")             give_item(id,"weapon_shield")             give_item(id,"weapon_deagle")             give_item(id,"ammo_50ae")             give_item(id,"ammo_50ae")             give_item(id,"ammo_50ae")             give_item(id,"ammo_50ae")             give_item(id,"ammo_50ae")             set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, TIME, 0.5, 1.5, 4 )             show_hudmessage(0, "ShieldWar mode has been enabled")         }     }     return PLUGIN_HANDLED

here's the one asskickr helped me edit, where do i put?

Peli 06-24-2004 19:46

I think this would be it , but I'm kinda new to scripting too :
Code:
/* AMXX Mod script. * * Shield War * Version Beta 1 * By: Poison_Jay * Special Thanks: Peli, Kingpin * * MSN: <a href="mailto:[email protected]">[email protected]</a> * * Commands: amx_shieldwar 1|0 * * Discription: All Players Spawn With Shield + Deagle */ #define TIME 5.0 #include <amxmodx> #include <fun> public plugin_init() {     register_plugin("Shield War","1","Poison_Jay");     register_event("CurWeapon","shield","be","1=1")     register_event("ResetHUD", "new_round", "b")     register_cvar("amx_shieldwar","1")     register_concmd("amx_shieldwar","amx_shieldwar",ADMIN_LEVEL_B,"1 = On 2 = Off") } public shield(id) {     if(get_cvar_num("amx_shieldwar")==0)            return PLUGIN_CONTINUE public new_round(id){    new players[32], numofplayers    get_players(players, numofplayers)    for (new i=0; i<numofplayers; i++){         if (get_cvar_num("amx_shieldwar")==1) {          new pid = players[i]          give_item(pid, "weapon_shield")          give_item(pid, "weapon_deagle")          give_item(pid, "ammo_50ae")          give_item(pid, "ammo_50ae")          give_item(pid, "ammo_50ae")          give_item(pid, "ammo_50ae")          give_item(pid, "ammo_50ae")          set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, TIME, 0.5, 1.5, 4 )          show_hudmessage(0, "ShieldWar mode has been enabled")      }    }    return PLUGIN_CONTINUE }

Poison_Jay 06-24-2004 23:10

nope

it got errors

/home/users/amxmodx/tmp/iFnEQvFb.sma(32) : warning 217: loose indentation
/home/users/amxmodx/tmp/iFnEQvFb.sma(32) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/iFnEQvFb.sma(32) : error 017: undefined symbol "new_round"
/home/users/amxmodx/tmp/iFnEQvFb.sma(52) : error 001: expected token: "}", but found "-end of file-"

3 Errors.


All times are GMT -4. The time now is 14:47.

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