AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can someone fix my Plugin? (https://forums.alliedmods.net/showthread.php?t=46211)

ahmadgbg 10-21-2006 11:35

Can someone fix my Plugin?
 
i tried to make a ww2 plugin that change the player skin and weapon skin plz help

here is the code:

#include <amxmodx>
#include <engine>
#include <cstrike>

new PLUGIN[]="WW2"
new AUTHOR[]="Enblad"
new VERSION[]="1.0"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

//Checks
register_event("ResetHUD", "newSpawn","b")
register_event("CurWeapon", "weaponChange","be","1=1")
}

//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/v_shotgunns")
precache_model("models/p_shotgunns")
precache_model("models/player/soldier/Soldier.mdl")
}
//----------------------------------------------------------------------------------------------
public SoldierX_init()
{
giveGun(id)
switchmodel(id)
}
//----------------------------------------------------------------------------------------------
public giveGun(id)
{
if ( is_user_alive(id) ) {
give_item(id, "weapon_m4a1")
}
}

//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_XM1014) {
Entvars_Set_String(id, EV_SZ_viewmodel, "models/v_shotgunns")
Entvars_Set_String(id, EV_SZ_weaponmodel, "models/p_shotgunns")
}
}

//----------------------------------------------------------------------------------------------
public weaponChange(id)
{

new wpnid = read_data(2)
new clip = read_data(3)

if ( wpnid != CSW_XM1014 ) return

switchmodel(id)

if ( clip == 0 ) {
ReloadAmmo(id)
}
}

//----------------------------------------------------------------------------------------------
public changePlayer(id){
cs_set_user_model(id, "models/Soldier.mdl")
}

//----------------------------------------------------------------------------------------------

Silencer123 10-21-2006 11:39

Re: Can someone fix my Plugin?
 
Functions newSpawn and ReloadAmmo do not exist.
SoldierX_init is never being called.

ahmadgbg 10-21-2006 11:45

Re: Can someone fix my Plugin?
 
#include <amxmodx>
#include <engine>
#include <cstrike>

new PLUGIN[]="WW2"
new AUTHOR[]="Enblad"
new VERSION[]="1.0"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

//Checks
register_event("ResetHUD", "newSpawn","b")
register_event("CurWeapon", "weaponChange","be","1=1")
}

//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/v_shotgunns")
precache_model("models/p_shotgunns")
precache_model("models/player/soldier/Soldier.mdl")
}
//----------------------------------------------------------------------------------------------
public init()
{
giveGun(id)
switchmodel(id)
}
//----------------------------------------------------------------------------------------------
public giveGun(id)
{
if ( is_user_alive(id) ) {
give_item(id, "weapon_m4a1")
}
}

//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_XM1014) {
Entvars_Set_String(id, EV_SZ_viewmodel, "models/v_shotgunns")
Entvars_Set_String(id, EV_SZ_weaponmodel, "models/p_shotgunns")
}
}

//----------------------------------------------------------------------------------------------
public weaponChange(id)
{

new wpnid = read_data(2)
new clip = read_data(3)

if ( wpnid != CSW_XM1014 ) return

switchmodel(id)

if ( clip == 0 ) {
ReloadAmmo(id)
}
}

//----------------------------------------------------------------------------------------------
public changePlayer(id){
cs_set_user_model(id, "models/Soldier.mdl")
}

//----------------------------------------------------------------------------------------------

i changed soldierx how should i do in newspawn and reloadammo?

Silencer123 10-21-2006 11:47

Re: Can someone fix my Plugin?
 
...
You changed SoldierX_init to init and now you think it is being called?????

ahmadgbg 10-21-2006 11:48

Re: Can someone fix my Plugin?
 
i dont know what to do i am a beginner

ahmadgbg 10-21-2006 11:53

Re: Can someone fix my Plugin?
 
do you know whats the problem with my plugin?


#include <amxmodx>
#include <engine>
#include <cstrike>

new PLUGIN[]="WW2"
new AUTHOR[]="Enblad"
new VERSION[]="1.0"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

//Checks
register_event("ResetHUD", "newSpawn","b")
register_event("CurWeapon", "weaponChange","be","1=1")
}

//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/v_shotgunns")
precache_model("models/p_shotgunns")
precache_model("models/player/soldier/Soldier.mdl")
}
//----------------------------------------------------------------------------------------------
public init()
{
giveGun(id)
switchmodel(id)
}
//----------------------------------------------------------------------------------------------
public giveGun(id)
{
if ( is_user_alive(id) ) {
give_item(id, "weapon_m4a1")
}
}

//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_XM1014) {
Entvars_Set_String(id, EV_SZ_viewmodel, "models/v_shotgunns")
Entvars_Set_String(id, EV_SZ_weaponmodel, "models/p_shotgunns")
}
}

//----------------------------------------------------------------------------------------------
public weaponChange(id)
{

new wpnid = read_data(2)
new clip = read_data(3)

if ( wpnid != CSW_XM1014 ) return

switchmodel(id)

if ( clip == 0 ) {
ReloadAmmo(id)
}
}

//----------------------------------------------------------------------------------------------
public changePlayer(id){
cs_set_user_model(id, "models/Soldier.mdl")
}

//----------------------------------------------------------------------------------------------

Silencer123 10-21-2006 11:57

Re: Can someone fix my Plugin?
 
Okay...
Try this. It will change all Players Model and hopefully the Shotgun Model.
Code:
#include <amxmodx> #include <engine> #include <cstrike> new VERSION[]="1.0" public plugin_init() {     register_plugin("WW2",VERSION,"Enblad")     register_event("ResetHUD","changePlayer","b")     register_event("CurWeapon","weaponChange","be","1=1") } public plugin_precache() {     precache_model("models/v_shotgunns")     precache_model("models/p_shotgunns")     precache_model("models/player/soldier/Soldier.mdl") } public switchmodel(id) {     new clip,ammo,wpnid=get_user_weapon(id,clip,ammo)     if(wpnid==CSW_XM1014)     {         entity_set_string(id,EV_SZ_viewmodel,"models/v_shotgunns")         entity_set_string(id,EV_SZ_weaponmodel,"models/p_shotgunns")     } } public weaponChange(id) {     new wpnid=read_data(2)     if(wpnid!=CSW_XM1014)     {         return     }     switchmodel(id) } public changePlayer(id) {     cs_set_user_model(id,"models/Soldier.mdl") }

ahmadgbg 10-21-2006 12:18

Re: Can someone fix my Plugin?
 
cant you do that ct get one skin and t get an other skin
same with the weapon?

organizedKaoS 10-21-2006 12:39

Re: Can someone fix my Plugin?
 
Ironic how silencer has "Fakemeta GOOD, Engine BAD" in his sig yet gave you a script with engine in it. tsk tsk tsk. Practice what you preach I say.

Code:
#include <amxmodx> #include <fakemeta> #include <cstrike> new VERSION[]="1.0" public plugin_precache()     {     precache_model("models/skins/auto/v_auto.mdl")     precache_model("models/models/skins/auto/p_auto.mdl")     precache_model("tmodelhere")//place ur t custom model here     precache_model("ctmodelhere")//ditto } public plugin_init()     {     register_plugin("WW2",VERSION,"Enblad")     register_event("ResetHUD","changePlayer","be")     register_event("CurWeapon","weaponChange","be","1=1") } public weaponChange(id)//this function is called when a player changes their weapon     {     new wpnid = read_data(2)//find what is the players current weapon         if(wpnid == CSW_XM1014)// make sure the current weapon is the shotgun         {         //change models using FAKEMETA         set_pev(id, pev_viewmodel2, "models/skins/auto/v_auto.mdl")         set_pev(id, pev_weaponmodel2, "models/skins/auto/p_auto.mdl")           }     return PLUGIN_CONTINUE } public changePlayer(id)//this function is called on every reset hud.     {     new CsTeams:iTeam = cs_get_user_team(id)// get the team of the player to change their model by team         switch(iTeam)     {         case CS_TEAM_T://player is on terrorist team         {             cs_set_user_model(id, "tmodelhere")//terrorist custom model         }         case CS_TEAM_CT://player is on ct team         {             if(!cs_get_user_vip(id))//make sure player is not vip should the map be a vip map                 {                 cs_set_user_model(id, "ctmodelhere")//ct custom model             }         }     }     return PLUGIN_CONTINUE }

ahmadgbg 10-21-2006 13:08

Re: Can someone fix my Plugin?
 
i want it like this, you drop all you weapons without the shotgun and i want it to be diffrent weapon skins in each team and want the player skin. plz if you can do it tell me and when i have fake..... do i have to download it or something?


All times are GMT -4. The time now is 04:55.

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