AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Toggle Camouflage (https://forums.alliedmods.net/showthread.php?t=143093)

tulgaoguz 11-14-2010 10:37

Toggle Camouflage
 
Hey guys! I wrote it but it isn't working.
Where is the wrong?
Could you help me

PHP Code:

new team;
team get_user_team(id);
if (
team == 1)  //TERRORIST
{
    
cs_set_user_model(id"urban");
}
else
{
    
cs_set_user_model(id"leet");



bibu 11-14-2010 10:50

Re: Toggle Camouflage
 
Show full code...and also use else if team == 2

tulgaoguz 11-14-2010 11:35

Re: Toggle Camouflage
 
here the full codes. Where is the wrong ? :/

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
 
public plugin_init()
{
     
register_plugin("CAMenu""0.10""Oguz&Tulga");
     
register_clcmd("say !camenu""CokAmacliMenu");
}
 
public 
CokAmacliMenu(id)
{
     new 
menu menu_create("\yCokAmacliMenu:""camenu_handler");
 
     
menu_additem(menu"\wCamouflage On&Off""1"ADMIN_LEVEL_A);
 
     
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
     
menu_display(idmenu0);
}
 
public 
camenu_handler(idmenuitem)
{
     if( 
item == MENU_EXIT )
     {
          
menu_destroy(menu);
 
          return 
PLUGIN_HANDLED;
     }
 
     new 
data[6], iName[64];
     new 
accesscallback;
 
     
menu_item_getinfo(menuitemaccessdata5iName63callback);
 
     new 
key str_to_num(data);
 
     switch(
key)
     {
          case 
1:
          {
               new 
team;
               
team get_user_team(id);
               if (
team == 1)  //TERRORIST
               
{
                    
cs_set_user_model(id"urban");
                    
set_hudmessage(25500, -1.0, -1.0);
                    
show_hudmessage(id"Suan CT Gorunumundesiniz");
               }
               else if (
team == 2)
               {
                    
cs_set_user_model(id"leet");
                    
set_hudmessage(25500, -1.0, -1.0);
                    
show_hudmessage(id"Suan T Gorunumundesiniz");
               }
 
               
CokAmacliMenu(id);
          }
     }
 
     return 
PLUGIN_HANDLED;



shuttle_wave 11-14-2010 13:55

Re: Toggle Camouflage
 
PHP Code:

#pragma semicolon 1

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

// Define the Plugin Version
new const VERSION[] = "1.0";

new 
boolg_bCamoflauge[33];

public 
plugin_init()
{
    
register_plugin("Camoflauge"VERSION"Shuttle_Wave");

    
register_clcmd("say !camenu""cmdCamoMenu"ADMIN_LEVEL_H);
    
register_clcmd("say /camenu""cmdCamoMenu"ADMIN_LEVEL_H);
    
    
register_menucmd(register_menuid("Camoflauge Menu"),    1023,    "CamoflaugeMenu_Handler");
}

public 
client_connect(id)
    
g_bCamoflauge[id] = false;

public 
cmdCamoMenu(id)
{
    static 
iLenszMenu[512], iKeys;
    
    
iKeys = ( MENU_KEY_0 MENU_KEY_1 );
    
    
iLen formatex(szMenusizeof(szMenu) - 1"\yCamoflauge Menu:^n\rby Shuttle_Wave^n^n");
    
    
iLen += formatex(szMenu[iLen], sizeof(szMenu) - iLen"\r1. \wCamoflauge [ \r%s\w ]^n"g_bCamoflauge[id] ? "ON" "OFF");
    
    
iLen += formatex(szMenu[iLen], sizeof(szMenu) - iLen"^n\r0. \wExit");
    
    
show_menu(idiKeysszMenu, -1"Camoflauge Menu");
    
    return 
PLUGIN_HANDLED;
}

public 
CamoflaugeMenu_Handler(idkey)
{
    switch(
key)
    {
        case 
0:
        {    
            if(
g_bCamoflauge[id])
            {
                
set_hudmessage(002550.080.8106.01.0);
                
show_hudmessage(id"Camoflauge Reseted");
                
                
cs_reset_user_model(id);
                
g_bCamoflauge[id] = false;
                
                
cmdCamoMenu(id);
                return 
PLUGIN_HANDLED;
            }
            
            if(!
g_bCamoflauge[id] && cs_get_user_team(id) == CS_TEAM_T)
            {
                
set_hudmessage(025500.030.8206.01.0);
                
show_hudmessage(id"You are now Camoflaged as CT");
                
                
cs_set_user_model(id"urban");
                
g_bCamoflauge[id] = true;
            }
            
            else if(!
g_bCamoflauge[id] && cs_get_user_team(id) == CS_TEAM_CT)
            {
                
set_hudmessage(4225500.040.8706.01.0);
                
show_hudmessage(id"You are now Camoflaged as Terrorist");
                
                
cs_set_user_model(id"leet");
                
g_bCamoflauge[id] = true;
            }
        }
        
        case 
9: return PLUGIN_HANDLED;
        
    }
    
    
cmdCamoMenu(id);
    
    return 
PLUGIN_HANDLED;



Kreation 11-15-2010 20:36

Re: Toggle Camouflage
 
Quote:

Originally Posted by bibu (Post 1349253)
Show full code...and also use else if team == 2

It doesn't need to be else if( team == 2 ), he could just leave it how it was in-case they go spectator. It might automatically make them 'urban' when they join spectator though. Not sure, but either way it doesn't matter.


All times are GMT -4. The time now is 11:25.

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