Raised This Month: $51 Target: $400
 12% 

Noob Thread


Post New Thread Reply   
 
Thread Tools Display Modes
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-25-2009 , 14:01   Re: Some errors with my code
Reply With Quote #11

Worth a try But i still need the stripping :S
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2009 , 14:08   Re: Some errors with my code
Reply With Quote #12

I wrote that touch forward, I remember writing that comment.

What exactly are you trying to do with this plugin?
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-25-2009 , 14:12   Re: Some errors with my code
Reply With Quote #13

It should strip players from start, no buyzones, no picking up of weapons, change models, and make a menu each round where you can choose a hero
[EDIT]
I have fixed stipping weapons, now just a new prob
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <fakemeta_util>

#define PLUGIN "WesternMod"
#define VERSION "1.0"
#define AUTHOR "TitANious"

#define my_menu 3.0
#define OFFSET_PRIMARYWEAPON        116 
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
#define MAX_PLAYER 41

new const iWeapBits =    
                
<< CSW_P228 
                
<< CSW_SCOUT 
                
<< CSW_XM1014 |
                
<< CSW_ELITE |
                
<< CSW_FIVESEVEN |
                
<< CSW_SG550     |
                
<< CSW_USP |
                
<< CSW_GLOCK18 |
                
<< CSW_AWP |    
                
<< CSW_M3 |
                
<< CSW_G3SG1 |
                
<< CSW_KNIFE |
                
<< CSW_DEAGLE;
        
new const 
CUSTOM_MODELS[33][] =
{
    
"models/new/v_p228.mdl",
    
"models/new/v_knife.mdl",
    
"models/new/v_scout.mdl",
    
"models/new/v_xm1014.mdl",
    
"models/new/v_elite.mdl",
    
"models/new/v_fiveseven.mdl",
    
"models/new/v_sg550.mdl",
    
"models/new/v_usp.mdl",
    
"models/new/v_glock18.mdl",
    
"models/new/v_awp.mdl",
    
"models/new/v_m3.mdl",
    
"models/new/v_g3sg1.mdl",
    
"models/new/v_deagle.mdl",

new 
g_MaxPlayers;
new 
g_fwSpawn
new 
gBuyzone;

new 
Float:gBuyzoneMin[3] = {-8192.0, -8192.0, -8192.0}
new 
Float:gBuyzoneMax[3] = {-8191.0, -8191.0, -8191.0}

new const 
entitys[][] =
{
    
"func_buyzone"
}

public 
plugin_precache()
{
    
g_fwSpawn register_forward(FM_Spawn"fw_Spawn")
    
    
gBuyzone =  fm_create_entity("func_buyzone");
    
engfunc(EngFunc_SetSizegBuyzonegBuyzoneMingBuyzoneMax)
    
dllfunc(DLLFunc_SpawngBuyzone)
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
unregister_forward(FM_Spawng_fwSpawn)
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost")
    
register_forward(FM_Touch,"fwTouch");
    
RegisterHam(Ham_Item_Deploy"weapon_scout""Scout_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_awp""awp_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_m3""m3_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_sg550""sg550_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_g3sg1""g3sg1_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_deagle""deagle_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_p228""p228_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_elite""elite_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_glock18""glock18_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_xm1014""xm1014_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_usp""usp_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_fiveseven""fiveseven_Deploy"1)
    
register_event("CurWeapon""Event_CurWeapon""be""1=1");
    
    
g_MaxPlayers get_maxplayers();    
}
public 
Event_CurWeapon(id)
{
    new 
iWeapon read_data(2);
    
    if( 
pev_validid ) && ( iWeapBits & ( << iWeapon ) ) )
        
set_pevid pev_viewmodel2 CUSTOM_MODELS[iWeapon] );
}  
public 
fw_Spawn(entity)
{
    if (!
pev_valid(entity)) return FMRES_IGNORED;
    
    new 
classname[32]
    
pev(entitypev_classnameclassnamesizeof classname 1)
    
    for (new 
0sizeof entitysi++)
    {
        if (
equal(classnameentitys[i]))
        {
            
engfunc(EngFunc_RemoveEntityentity)
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;
}


public 
fwHamPlayerSpawnPost(id)
{
    
set_task(my_menu"WesternMod"id);
    return 
HAM_IGNORED;
}
public 
drop(id)
{
    
strip_user_weapons(id)
    
set_pdata_int(idOFFSET_PRIMARYWEAPON0)
}  
public 
WesternMod(id)
{
    new 
menu menu_create("\rWestern Mod Menu:""handleWesternMod")
    
menu_additem(menu"\wLucky Luke""1"0)
    
menu_additem(menu"\wBilly the Kid""2"0)
    
menu_additem(menu"\wClint Eastwood""3"0)
    
menu_additem(menu"\wJohnny Thunder""4"0)
    
menu_additem(menu"\wPow Wow Smith""5"0)
    
menu_additem(menu"\wWarren Olney""6"0)
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}
public 
handleWesternMod(idmenuitem)
{    
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accesscallback

    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    new 
key str_to_num(data)

    switch(
key)
    {
        case 
1:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_awp" )
        
give_item id"ammo_338magnum" )
        
give_item id"ammo_338magnum" )
        
give_item id"ammo_338magnum" )
        
give_item id"ammo_338magnum" )
        
give_item id"ammo_338magnum" )
        
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")
        
set_user_maxspeed(id300.0)
        }
        case 
2:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_g3sg1" )
        
give_item id"ammo_762nato")
        
give_item id"ammo_762nato")
        
give_item id"ammo_762nato")
        
give_item id"ammo_762nato")
        
give_item id"ammo_762nato")
        
give_item id"ammo_762nato")
        
give_item id"weapon_p228")
        
give_item id"ammo_357sig")
        
give_item id"ammo_357sig")
        
give_item id"ammo_357sig")
        
give_item id"ammo_357sig")
        
set_user_gravity id0.6)
        }
        case 
3:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_sg550" )
        
give_item id"ammo_556nato")
        
give_item id"ammo_556nato")
        
give_item id"ammo_556nato")
        
give_item id"ammo_556nato")
        
give_item id"ammo_556nato")
        
give_item id"weapon_elite")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
set_user_armorid255)
        }
        case 
4:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_scout" )
        
give_item id"ammo_762nato" )
        
give_item id"ammo_762nato" )
        
give_item id"ammo_762nato" )
        
give_item id"ammo_762nato" )
        
give_item id"ammo_762nato" )
        
give_item id"weapon_glock18")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
give_item id"ammo_9mm")
        
set_user_healthid255)
        }
        case 
5:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_m3")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"weapon_usp")
        
give_item id"ammo_45acp")
        
give_item id"ammo_45acp")
        
give_item id"ammo_45acp")
        
give_item id"ammo_45acp")
        
set_user_armorid255)
        
set_user_healthid255)
        
set_user_maxspeed(id200.0)
        }
        case 
6:
        {
        
drop (id)
        
give_item id"weapon_knife" )
        
give_item id"weapon_xm1014")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"ammo_buckshot")
        
give_item id"weapon_fiveseven")
        
give_item id"ammo_57mm")
        
give_item id"ammo_57mm")
        
give_item id"ammo_57mm")
        
give_item id"ammo_57mm")
        
set_user_armorid255)
        
set_user_healthid255)
        
set_user_maxspeed(id200.0)
        }
    }  
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
fwTouchent id )
{
    if ( !( 
<= id <= g_MaxPlayers ) || !pev_valident ) || !( pevent pev_flags ) & FL_ONGROUND ) )
        return 
FMRES_IGNORED;
    
    
//This will block picking up all weapons except backpack (c4)

    
static szEntModel[32];
    
pevent pev_model szEntModel 31 );
    
    return 
equalszEntModel "models/w_backpack.mdl" ) ? FMRES_IGNORED FMRES_SUPERCEDE

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Invalid expression, assumed zero on line 48
Error: Invalid function or declaration on line 48
Error: Undefined symbol "g_MaxPlayers" on line 89
Error: Undefined symbol "g_MaxPlayers" on line 267

4 Errors.
Could not locate output file C:\Users\Jacob\Desktop\amxx_western.amx (compile failed).
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 04-25-2009 at 14:14.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2009 , 14:14   Re: Some errors with my code
Reply With Quote #14

Ok, so what is not working as of now? [post your completed code if it needs more work]
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-25-2009 , 14:16   Re: Some errors with my code
Reply With Quote #15

I've did posted all code all the time
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2009 , 14:20   Re: Some errors with my code
Reply With Quote #16

Quote:
Originally Posted by TitANious View Post
I've did posted all code all the time
You edited the models array I made. You must keep it as I made it for it to work properly. Once you fix that it will compile.

Replace with:
PHP Code:
new const CUSTOM_MODELS[33][] =
{
    
"models/new/v_p228.mdl",
    
"",
    
"",
    
"models/new/v_scout.mdl",
    
"",
    
"models/new/v_xm1014.mdl",
    
"",
    
"",
    
"",
    
"",
    
"models/new/v_elite.mdl",
    
"models/new/v_fiveseven.mdl",
    
"",
    
"models/new/v_sg550.mdl",
    
"",
    
"",
    
"models/new/v_usp.mdl",
    
"models/new/v_glock18.mdl",
    
"models/new/v_awp.mdl",
    
"",
    
"",
    
"models/new/v_m3.mdl",
    
"",
    
"",
    
"models/new/v_g3sg1.mdl",
    
"",
    
"models/new/v_deagle.mdl",
    
"",
    
"",
    
"",
    
"",
    
"",
    
""
}; 
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-25-2009 , 14:22   Re: Some errors with my code
Reply With Quote #17

I need knife to, why should it be like that?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2009 , 14:26   Re: Some errors with my code
Reply With Quote #18

Because it is finding the correct model name based on the weapon index. Weapon index ranges from 1-32 so they must be located at the appropriate index in the array for the proper model to be assigned.

You must replace both iWeapBits and the model names array. This has knife added

PHP Code:
new const iWeapBits =    
        
<< CSW_P228 
        
<< CSW_SCOUT 
        
<< CSW_XM1014 |
        
<< CSW_ELITE |
        
<< CSW_FIVESEVEN |
        
<< CSW_SG550     |
        
<< CSW_USP |
        
<< CSW_GLOCK18 |
        
<< CSW_AWP |    
        
<< CSW_M3 |
        
<< CSW_G3SG1 |
        
<< CSW_KNIFE |
        
<< CSW_DEAGLE |
        
<< CSW_KNIFE;
        
new const 
CUSTOM_MODELS[33][] =
{
    
"models/new/v_p228.mdl",
    
"",
    
"",
    
"models/new/v_scout.mdl",
    
"",
    
"models/new/v_xm1014.mdl",
    
"",
    
"",
    
"",
    
"",
    
"models/new/v_elite.mdl",
    
"models/new/v_fiveseven.mdl",
    
"",
    
"models/new/v_sg550.mdl",
    
"",
    
"",
    
"models/new/v_usp.mdl",
    
"models/new/v_glock18.mdl",
    
"models/new/v_awp.mdl",
    
"",
    
"",
    
"models/new/v_m3.mdl",
    
"",
    
"",
    
"models/new/v_g3sg1.mdl",
    
"",
    
"models/new/v_deagle.mdl",
    
"",
    
"",
    
"models/new/v_knife.mdl",
    
"",
    
"",
    
""
}; 
__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-25-2009 , 14:32   Re: Some errors with my code
Reply With Quote #19

Its still dont works, the stipping and the thing that you cant pick things up, dont work..
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2009 , 14:41   Re: Some errors with my code
Reply With Quote #20

Quote:
Originally Posted by TitANious View Post
Its still dont works, the stipping and the thing that you cant pick things up, dont work..
It would work but your plugin is erroring at mapchange since multiple ham forwards are registered to call a function that doesn't exist. What was your intention with this?

PHP Code:
RegisterHam(Ham_Item_Deploy"weapon_scout""Scout_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_awp""awp_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_m3""m3_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_sg550""sg550_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_g3sg1""g3sg1_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_deagle""deagle_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_p228""p228_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_elite""elite_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_glock18""glock18_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_xm1014""xm1014_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_usp""usp_Deploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_fiveseven""fiveseven_Deploy"1
__________________
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:22.


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