AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   First plugin help (https://forums.alliedmods.net/showthread.php?t=26468)

Rohit 04-02-2006 16:43

First plugin help
 
Hello,

When I load my (first) plugin in the server. It says that de event is wrong. Ramono and I couldn't find the good event. So I hope if one of you guys can help me :lol:

And yes, the code is from Ramono I have permission from him 2 use it. And I'm justing practicing :oops:

//edit
Forgotten :roll:
it's for TS


Code:

public plugin_init() {
        register_plugin("Eerste plugin", "1.0", "Ro-WieT")
        register_event("Curweapon","Event_curweapon", "be")
        register_cvar("sv_speed", "1")
        register_concmd("amx_m4","cv_speed", ADMIN_CVAR," : <0 or 1 or 2> Change's  CVAR")
}

public Event_curweapon(id)
{
        new iClip, iAmmo, iWeapID = get_user_weapon(id, iClip, iAmmo)
        {
                if (get_cvar_num("sv_speed") == 0)
                {
                        if (iWeapID == TSW_M4A1)
                        set_user_maxspeed (id, 275.0)
                        else
                        set_user_maxspeed (id, 275.0)
                }
               
                if (get_cvar_num("sv_speed") == 1)
                {
                        if (iWeapID == TSW_M4A1)
                        set_user_maxspeed (id, 1500.0)
                        else
                        set_user_maxspeed (id, 275.0)
                }
               
                if (get_cvar_num("sv_speed") == 2)
                {
                        if (iWeapID == TSW_M4A1)
                        set_user_maxspeed (id, 1500.0)
                        ts_createpwup (TSPWUP_SUPERJUMP) + 256
                        else
                        set_user_maxspeed (id, 1500.0)
                        ts_createpwup (TSPWUP_SUPERJUMP) - 256
                }
               
        }
}


Hawk552 04-02-2006 17:21

Curweapon :arrow: CurWeapon

Rohit 04-03-2006 14:13

Quote:

Originally Posted by Hawk552
Curweapon :arrow: CurWeapon

k, thanks.
Will test it out :lol:
//edit

It's doesn't work's, but I was forgotten 2 say that it is for TS :oops:

Hawk552 04-03-2006 16:33

In the server console, type "meta game" and give me the results.

Rohit 04-04-2006 10:07

Quote:

Originally Posted by Hawk552
In the server console, type "meta game" and give me the results.

Ok, here's the meta game list.
Code:

meta game
GameDLL info:
        name: ts
        desc: The Specialists
    gamedir: c:\program files\steam\steamapps\princepersia\half-life/ts
    dll file: mp.dll
dll pathname: c:\program files\steam\steamapps\princepersia\half-life/ts/dlls/mp.dll
Game registered user msgs:    msgid  size
  VoiceMask                    64      8
  ReqState                    65      0
  SelAmmo                      66      4
  CurWeapon                    67      3
  Geiger                      68      1
  Flashlight                  69      2
  FlashBat                    70      1
  Health                      71      1
  Damage                      72    12
  Battery                      73      2
  Train                        74      1
  HudText                      75    -1
  SayText                      76    -1
  TextMsg                      77    -1
  WeaponList                  78    -1
  ResetHUD                    79      1
  InitHUD                      80      0
  GameTitle                    81      1
  DeathMsg                    82    -1
  ScoreInfo                    83      9
  TeamInfo                    84    -1
  TeamScore                    85    -1
  GameMode                    86      1
  MOTD                        87    -1
  ServerName                  88    -1
  AmmoPickup                  89      2
  WeapPickup                  90      1
  ItemPickup                  91    -1
  HideWeapon                  92      1
  SetFOV                      93      1
  ShowMenu                    94    -1
  ScreenShake                  95      6
  ScreenFade                  96    10
  AmmoX                        97      2
  TeamNames                    98    -1
  VGUIMenu                    99      1
  WeaponInfo                  100      6
  ClipInfo                    101      1
  WStatus                    102      2
  ActItems                    103      2
  KFuPower                    104      1
  TSHealth                    105      1
  TSArmor                    106      1
  TSState                    107      1
  TSCash                      108      2
  TSSpace                    109      1
  NextStunt                  110      1
  PwUp                        111      3
  PwUpTime                    112      1
  RoundTime                  113      2
  Objective                  114    -1
  DelObj                      115      1
  Wires                      116      3
  GloSlow                    117      1
  SrvSett                    118      3
  TSPAward                    119      2
  TSBTime                    120      1
  TSHVoice                    121      1
  CustomWP                    122    -1
  Spectator                  123      2
  TSMessage                  124    -1
  TSSlowMo                    125      2
  PTakeDam                    126    13
  TSFrags


Hawk552 04-04-2006 10:25

I see CurWeapon in that list. You must be doing it incorrectly.

Code:
register_event("CurWeapon","my_function","be","1>0")

Rohit 04-04-2006 13:48

'K, now the event is working. But now it has another problem, with line 18.
here's the code ( line 18 is the register_concmd, problem with cv_speed )
Code:

public plugin_init() {
        register_plugin("Eerste plugin", "1.0", "Ro-WieT")
        register_event("CurWeapon","Event_CurWeapon","be")
        register_cvar("m4a1_on","1")
        register_concmd("amx_m4","cv_speed", ADMIN_CVAR," : <0 or 1 or 2> Change's CVAR")
}

public Event_CurWeapon(id)
        {
        new iClip, iAmmo, iWeapID = get_user_weapon(id, iClip, iAmmo)
        {
                if (get_cvar_num("m4a1_on") == 0)
                        {
                        if (iWeapID == TSW_M4A1)
                                set_user_maxspeed (id, 275.0)
                        else
                                set_user_maxspeed (id, 275.0)
                }
               
                if (get_cvar_num("m4a1_on") == 1)
                        {
                        if (iWeapID == TSW_M4A1)
                                set_user_maxspeed (id, 1500.0)
                        else
                                set_user_maxspeed (id, 275.0)
                }
               
                if (get_cvar_num("m4a1_on") == 2)
                        {
                        if (iWeapID == TSW_M4A1)
                                {
                                set_user_maxspeed (id, 1500.0)
                                ts_createpwup (TSPWUP_SUPERJUMP) + 256
                        }
                        else
                                {
                                set_user_maxspeed (id, 1500.0)
                                ts_createpwup (TSPWUP_SUPERJUMP) - 256
                        }
                }
               
        }
}


P34nut 04-04-2006 13:53

I think you need a cvar:
Code:
register_cvar("amx_m4","0")

http://www.amxmodx.org/funcwiki.php?...cvar&go=search

Rohit 04-04-2006 14:05

nop, won't work. :cry:

ObscureAlucard 04-04-2006 15:37

you want the concmd cv_speed to turn off the cvar amx_m4a1 0? or 1? like switch between the 2?


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

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