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

What's wrong with my code?


Post New Thread Reply   
 
Thread Tools Display Modes
vermillioN25
Member
Join Date: Apr 2009
Location: Brazil
Old 08-07-2009 , 12:32   Re: What's wrong with my code?
Reply With Quote #11

Here is:

PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "JailMod"
#define VERSION "1.0"
#define AUTHOR "elemeNt;"

new g_MaxPlayers

new g_pcvaramount

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
register_logevent("logevent_round_end"2"1=Round_End")
    
register_forwardFM_CmdStart"FMCmdStart" );
    
g_pcvaramount register_cvar("jail_tinvis_amount""45")
    
    
g_MaxPlayers get_maxplayers()
}

public 
fwHamPlayerSpawnPostiPlayer )
{
    if( 
is_user_aliveiPlayer ) )
    {
    
strip_user_weaponsiPlayer )
    
give_itemiPlayer,"weapon_knife" )
    
    if ( 
get_user_teamiPlayer ) == )
    {
        
give_itemiPlayer,"weapon_m4a1" )
        
give_itemiPlayer,"ammo_556nato" )
        
give_itemiPlayer,"ammo_556nato" )
        
give_itemiPlayer,"ammo_556nato" )
        
give_itemiPlayer,"weapon_deagle" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"ammo_50ae" )
        
give_itemiPlayer,"weapon_hegrenade" )
        }
    } 
}

public 
logevent_round_end() //Remove weapons on RoundEnd
{
    for(new 
i=1i<=g_MaxPlayersi++)
    {
        if(
is_user_alive(i) )
        {
        
strip_user_weapons (i//Strip weapons on round end
        
give_item(i,"weapon_knife"//Give Knife on round end
    
        
}    
    }
}

public 
FMCmdStartiduc_handlerandseed )
{
    new 
Float:fmoveFloat:smove;
    
get_uc(uc_handleUC_ForwardMovefmove);
    
get_uc(uc_handleUC_SideMovesmove );
    
    new 
Float:maxspeed;
    
pev(idpev_maxspeedmaxspeed);
    new 
Float:walkspeed = (maxspeed 0.52); 
    
fmove floatabsfmove );
    
smove floatabssmove );
    
    
    if( 
is_user_alive(id) && get_user_team(id) == 1)
    {
    if(
fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0))
        {
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlphaget_pcvar_num(g_pcvaramount))
        }
        else
        {
        
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)
        }
    }
    else
    {
    } 

__________________

Last edited by vermillioN25; 08-07-2009 at 12:41.
vermillioN25 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-07-2009 , 12:41   Re: What's wrong with my code?
Reply With Quote #12

remove register_logevent("logevent_round_end", 2, "1=Round_End")

and public ... too, since you dont need it.
__________________
xPaw is offline
vermillioN25
Member
Join Date: Apr 2009
Location: Brazil
Old 08-07-2009 , 12:56   Re: What's wrong with my code?
Reply With Quote #13

Thanks

Is this code fine?
PHP Code:
public FMCmdStartiduc_handlerandseed )
{
    new 
Float:fmoveFloat:smove;
    
get_uc(uc_handleUC_ForwardMovefmove);
    
get_uc(uc_handleUC_SideMovesmove );
    
    new 
Float:maxspeed;
    
pev(idpev_maxspeedmaxspeed);
    new 
Float:walkspeed = (maxspeed 0.52); 
    
fmove floatabsfmove );
    
smove floatabssmove );
    
    
    if( 
is_user_alive(id) && get_user_team(id) == 1)
    {
    if(
fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0))
        {
        
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlphaget_pcvar_num(g_pcvaramount))
        }
        else
        {
        
set_user_rendering(idkRenderFxNone0,0,0kRenderNormal255)
        }
    }
    else
    {
    } 

I don't got any error, but I just want to know if I'm coding the right way.
__________________
vermillioN25 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-07-2009 , 13:07   Re: What's wrong with my code?
Reply With Quote #14

Test yourself. Don't ask each time if it's right or wrong. If you want to learn, the best way is to experience yourself. Sorry but it's idiot to wait several hours waiting approval from someone when you could test it in 2 minutes.
__________________
Arkshine is offline
vermillioN25
Member
Join Date: Apr 2009
Location: Brazil
Old 08-07-2009 , 13:23   Re: What's wrong with my code?
Reply With Quote #15

Ok dude. I think you can close the thread now
__________________
vermillioN25 is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-07-2009 , 20:23   Re: What's wrong with my code?
Reply With Quote #16

PHP Code:
        strip_user_weapons (i//Strip weapons on round end
        
give_item(i,"weapon_knife"//Give Knife on round end 


PHP Code:
        strip_user_weapons (i//Strip weapons on round end
        
set_pdata_int (i1160// fixes bug where once in a while players can not pick up weapons
        
give_item(i,"weapon_knife"//Give Knife on round end 
Good luck with your script
VMAN is offline
vermillioN25
Member
Join Date: Apr 2009
Location: Brazil
Old 08-07-2009 , 20:37   Re: What's wrong with my code?
Reply With Quote #17

Thank you VMAN

//Edit
I'm getting error when compiling
__________________

Last edited by vermillioN25; 08-07-2009 at 20:44.
vermillioN25 is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-07-2009 , 20:56   Re: What's wrong with my code?
Reply With Quote #18

What's the error?


EDIT: Add
PHP Code:
#include <fakemeta> 
to your includes and it should compile properly.
VMAN is offline
vermillioN25
Member
Join Date: Apr 2009
Location: Brazil
Old 08-07-2009 , 21:17   Re: What's wrong with my code?
Reply With Quote #19

I'm already using FakeMeta x_x

//Edit

This errors:

Quote:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team

//// jailmod.sma
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : error 017: undefined symbol "i"
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : warning 215: expression has no effect
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : warning 215: expression has no effect
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : error 001: expected token: ";", but found ")"
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : error 029: invalid expression, assumed zero
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\s cripting\jailmod.sma(
39) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file compiled\jailmod.amx (compile failed).
//
// Compilation Time: 0,12 sec
// ----------------------------------------

Press enter to exit ...
__________________
vermillioN25 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-07-2009 , 22:05   Re: What's wrong with my code?
Reply With Quote #20

PHP Code:
set_pdata_int (i1160
-->

PHP Code:
set_pdata_int (iPlayer1160
Cuz now you arent using a loop...

PHP Code:
public fwHamPlayerSpawnPostiPlayer 
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 18:56.


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