AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player model[Help] (https://forums.alliedmods.net/showthread.php?t=160062)

usaexelent 06-24-2011 15:30

Player model[Help]
 
How to make that a random player would get different knife skin, and the others wouldn't?

nikhilgupta345 06-24-2011 15:38

Re: Player model[Help]
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

new bool:g_bCustomSkin33 ]; // Holder for whether player gets a custom model or not

new g_szViewModel[ ] = ""// View model location
new g_szWeaponModel[ ] = ""// Weapon model location


public plugin_precache()
{
    
precache_modelg_szViewModel );
    
precache_modelg_szWeaponModel );
}

public 
plugin_init()
{
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon

    
register_clcmd"say /randomknife""CmdKnife" );
}


public 
Event_CurWeaponid )
{
    if( !
is_user_aliveid ) || !g_bCustomSkinid ] ) // If they aren't alive or they don't have a custom skin return
        
return PLUGIN_CONTINUE;
    
    if( 
get_user_weaponid ) == CSW_KNIFE // If weapon is a knife
    
{
        
set_pevidpev_viewmodel2g_szViewModel ); // set models
        
set_pevidpev_weaponmodel2g_szWeaponModel ); // set models
    
}
}

public 
CmdKnifeid )
{
    if( !( 
get_user_flagsid ) & ADMIN_BAN // If they don't have BAN flag return
        
return PLUGIN_HANDLED;
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum );
    
    new 
iRand randomiNum ); // Get random player
    
    
g_bCustomSkiniPlayersiNum ] ] = true// Set the array index to true



usaexelent 06-24-2011 15:52

Re: Player model[Help]
 
i get errors

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

Warning: Function "Event_CurWeapon" should return a value on line 34
Error: Expected token: ")", but found "return" on line 39
Error: Expected token: "}", but found "-end of file-" on line 46

2 Errors.
Could not locate output file C:\Documents and Settings\EasyNote\Desktop\plugin.amx (compile failed).



:(

fysiks 06-24-2011 16:09

Re: Player model[Help]
 
Add another parenthesis to the end of line 38.

2reason2kill 06-24-2011 16:15

Re: Player model[Help]
 
Quote:

Originally Posted by nikhilgupta345 (Post 1495508)
PHP Code:

#include <amxmodx>
#include <fakemeta>

new bool:g_bCustomSkin33 ]; // Holder for whether player gets a custom model or not

new g_szViewModel[ ] = ""// View model location
new g_szWeaponModel[ ] = ""// Weapon model location


public plugin_precache()
{
    
precache_modelg_szViewModel );
    
precache_modelg_szWeaponModel );
}

public 
plugin_init()
{
    
register_event"CurWeapon""Event_CurWeapon""be""1=1" ); // Register curweapon

    
register_clcmd"say /randomknife""CmdKnife" );
}


public 
Event_CurWeaponid )
{
    if( !
is_user_aliveid ) || !g_bCustomSkinid ] ) // If they aren't alive or they don't have a custom skin return
        
return PLUGIN_CONTINUE;
    
    if( 
get_user_weaponid ) == CSW_KNIFE // If weapon is a knife
    
{
        
set_pevidpev_viewmodel2g_szViewModel ); // set models
        
set_pevidpev_weaponmodel2g_szWeaponModel ); // set models
    
}
}

public 
CmdKnifeid )
{
    if( !( 
get_user_flagsid ) & ADMIN_BAN // If they don't have BAN flag return
        
return PLUGIN_HANDLED;
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum );
    
    new 
iRand randomiNum ); // Get random player
    
    
g_bCustomSkiniPlayersiNum ] ] = true// Set the array index to true



Can I Do Case?


Like

Case CSW_Somting.

fysiks 06-24-2011 16:19

Re: Player model[Help]
 
Quote:

Originally Posted by 2reason2kill (Post 1495539)
Can I Do Case?


Like

Case CSW_Somting.

What do you mean?

Exolent[jNr] 06-24-2011 16:22

Re: Player model[Help]
 
Quote:

Originally Posted by 2reason2kill (Post 1495539)
Can I Do Case?


Like

Case CSW_Somting.

Why are you hijacking another person's thread?

usaexelent 06-24-2011 16:25

Re: Player model[Help]
 
The plugin doesn't work, when i write /randomknife nothing happens.

2reason2kill and dont mind him, every thing is ok if you need help witch involves this thread question then ok

fysiks 06-24-2011 16:32

Re: Player model[Help]
 
Quote:

Originally Posted by usaexelent (Post 1495547)
The plugin doesn't work, when i write /randomknife nothing happens.

2reason2kill and dont mind him, every thing is ok if you need help witch involves this thread question then ok

ARe you sure you have the ban flag?

Also, I found a mistake. Fixed below:

PHP Code:

public CmdKnifeid )
{
    if( !( 
get_user_flagsid ) & ADMIN_BAN ) ) // If they don't have BAN flag return
        
return PLUGIN_HANDLED;
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum );
    
    new 
iRand randomiNum ); // Get random player
    
    
g_bCustomSkiniPlayersiRand ] ] = true// Set the array index to true



usaexelent 06-24-2011 16:32

Re: Player model[Help]
 
Fixed change this line

g_bCustomSkin[ iPlayers[ iNum ] ] = true; // Set the array index to true

to:

g_bCustomSkin[ iPlayers[ iRand ] ] = true; // Set the array index to true


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

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