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=22449)

gameslayer 12-27-2005 02:52

first plugin HELP
 
OK i have been looking for plugin that easily changes the skin of a weapon, but found none that i could get to work. so i sarted making my own plugin.i found the source code of aim the ak which switches the skin and aims the ak. i used the code and changed all ak names directories etc. this is what i got
Code:
#include <amxmodx> #include <engine> #define PLUGIN  "Aim the M4" #define VERSION "1.0" #define AUTHOR  "BLADE" new bool:AAK[33] new LastWeapon[33] new Float:PATime[33] new Float: OldPA[33][3] new Float:SwitchTime[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public plugin_precache() {     precache_model("models/v_aimm4a1.mdl")     precache_model("models/v_m4a1.mdl") } public client_PreThink(id) {     new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)     if(Weapon == CSW_m4a1 && Clip > 0)     {         if(get_user_button(id) & IN_ATTACK && AAK[id] && (PATime[id] + 0.1) < get_gametime())         {             new Float:PAPower[3]             entity_get_vector(id, EV_VEC_punchangle, PAPower)             for(new i = 0; i < 3; i++)             {                 PAPower[i] = ((PAPower[i] + OldPA[id][i]) / 2)                 OldPA[id][i] = PAPower[i]             }             entity_set_vector(id, EV_VEC_punchangle, PAPower)                         PATime[id] = get_gametime()             LastWeapon[id] = Weapon         }         else if(get_user_oldbutton(id) & IN_ATTACK)             for(new i = 0; i < 3; i++) OldPA[id][i] = 0.0                 if(get_user_button(id) & IN_ATTACK2)         {             if((SwitchTime[id] + 1.0) < get_gametime())             {                 switch(AAK[id])                 {                     case true: AAK[id] = false                     case false: AAK[id] = true                 }                 SwitchTime[id] = get_gametime()             }         }     }     return PLUGIN_CONTINUE } public client_PostThink(id) {     new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)     if(Weapon == CSW_m4a1)     {         switch(AAK[id])         {             case true: entity_set_string(id, EV_SZ_viewmodel, "models/v_aimm4a1.mdl")             case false: entity_set_string(id, EV_SZ_viewmodel, "models/v_m4a1.mdl")         }     }     return PLUGIN_CONTINUE }
but when i compile i get eror with CSW_m4a1 in both lines
PLZ HELP this is my first plugin and i am a noob at coding. :oops:

[+] 12-27-2005 04:42

Code:
#include <cstrike>

Add that.

Xanimos 12-27-2005 10:46

No you dont need to include cstrike module...
change CSW_m4a1 to CSW_M4A1

gameslayer 12-27-2005 14:02

OK thank you. i Haven't checked it in game but at least it compiled.

gameslayer 12-27-2005 15:26

bind problem
 
um how do i rebind it to mouse 3 because mouse 2 on the m4 is binded to the silencer. so half of the plugin is dead.

Xanimos 12-27-2005 16:26

Re: bind problem
 
Quote:

Originally Posted by gameslayer
um how do i rebind it to mouse 3 because mouse 2 on the m4 is binded to the silencer. so half of the plugin is dead.

Not that simple. Its not checking for Mouse2 its checking for +attack2.

gameslayer 12-27-2005 18:00

umm so how do i do it?

gameslayer 12-27-2005 18:14

plz help its a big problem and i don't know what to do

[+] 12-27-2005 18:31

Oh, hmm...I just thought CSW would require the "cstrike" module. Sorry. :( Thanks for correction Suicid3. :D

gameslayer 12-27-2005 18:55

yay i posted the plugin
http://forums.alliedmods.net/showthr...=194056#200166


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

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