Raised This Month: $ Target: $400
 0% 

Module Coding Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xvil
BANNED
Join Date: Feb 2012
Old 02-28-2012 , 14:24   Module Coding Error
Reply With Quote #1

There is many Errors in my module Please help

PHP Code:
stock is_user_team_ct(id)
{
    new 
__teamct=get_user_team(id);
    
    return (
__teamct==CS_TEAM_CT);
}

stock is_user_team_t(id)
{
    new 
__teamt=get_user_team(id);
    
    return (
__teamt==CS_TEAM_T);
}

stock is_user_team_spectator(id)
{
    new 
__teamspec=get_user_team(id);
    
    return (
__teamspec==CS_TEAM_SPECTATOR);
}

stock is_user_admin_kick(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_ban(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_cvar(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_rcon(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>10 && !(__flags&ADMIN_USER));
}
stock is_user_admin_reservastion(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags==&& !(__flags&ADMIN_USER));
}
stock is_user_admin_immunity(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_cfg(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_chat(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_map(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_menu(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>19 && !(__flags&ADMIN_USER));
}
stock is_user_admin_passowrd(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_slay(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_vip(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>23 && !(__flags&ADMIN_USER));

stock is_user_admin_vote(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>&& !(__flags&ADMIN_USER));
}
stock is_user_admin_level_a(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>11 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_b(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>12 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_c(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>13 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_d(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>14 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_e(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>15 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_f(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>16 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_g(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>17 && !(__flags&ADMIN_USER));
}
stock is_user_admin_level_h(id)
{
    new 
__flags=get_user_flags(id);
    return (
__flags>18 && !(__flags&ADMIN_USER));

Full Module Source Code
Spoiler

Last edited by Xvil; 02-28-2012 at 14:26.
Xvil is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 02-28-2012 , 14:26   Re: Module Coding Error
Reply With Quote #2

What is the reason to use something like this at all?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-28-2012 , 14:34   Re: Module Coding Error
Reply With Quote #3

Those admin level checks are all wrong.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-28-2012 , 21:03   Re: Module Coding Error
Reply With Quote #4

No offense but this is a step backwards in innovation.
__________________
fysiks is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-28-2012 , 22:41   Re: Module Coding Error
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
No offense but this is a step backwards in innovation.
Sorry for my completely off topic +1 but i laughed very hard at this.
Doc-Holiday is offline
Xvil
BANNED
Join Date: Feb 2012
Old 02-29-2012 , 05:47   Re: Module Coding Error
Reply With Quote #6

it can facilitate

Example:

PHP Code:
new team get_user_team(id)

if(!
team == CS_TEAM_CT)
   return

// ................... 
You Can do This Only

PHP Code:
if(!is_user_team_ct(id))
  return

// ............ 
if it's not possible
I will search to do another idea
And thanks
Xvil is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-29-2012 , 05:49   Re: Module Coding Error
Reply With Quote #7

if i'm not wrong , get_user_team returns a number from team , ex , T : 1 , CT : 2.

cs_get_user_team returns CS_TEAM_*
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Xvil
BANNED
Join Date: Feb 2012
Old 02-29-2012 , 08:06   Re: Module Coding Error
Reply With Quote #8

It's Return 1,2,3 or 0 but i must use
PHP Code:
cs_get_user_team(index, &{CsInternalModel,_}:model CS_DONTCHANGE); 
PHP Code:
/* Get team directly from player's entity.
 * 1 = terrorist
 * 2 = counter-terrorist
 * 3 = spectator
 */
enum CsTeams {
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
};
native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model CS_DONTCHANGE); 
Fixed is_user_team_t(id)
Fixed is_user_team_spectator(id)
Fixed is_user_team_ct(id)
Spoiler
Xvil is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-29-2012 , 10:25   Re: Module Coding Error
Reply With Quote #9

Quote:
Originally Posted by Xvil View Post
it can facilitate

Example:

PHP Code:
new team get_user_team(id)

if(!
team == CS_TEAM_CT)
   return

// ................... 
You Can do This Only

PHP Code:
if(!is_user_team_ct(id))
  return

// ............ 
if it's not possible
I will search to do another idea
And thanks
It's much simpler to just use (there is no need to create new variable if it won't be used more than once):

PHP Code:
if( cs_get_user_team(id) == CS_TEAM_CT )
{
    
// Player is CT

or if you need to know which team they are on and not if they are on one particular team you would do:

PHP Code:
switch( cs_get_user_team(id) )
{
    case 
CS_TEAM_CT:
    {
        
// Player is CT
    
}
    case 
CS_TEAM_T:
    {
        
// Player is T
    
}
    case 
CS_TEAM_SPECTATOR:
    {
        
// Player is Spectator
    
}

__________________
fysiks is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-01-2012 , 07:15   Re: Module Coding Error
Reply With Quote #10

Ok Thanks For All
Xvil 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 21:16.


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