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

Solved unkown code error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 08-19-2017 , 09:18   unkown code error
Reply With Quote #1

I coded this after many compiling errors, but when Itried it it didn't work.
it was suposed to be used to change the skin to a random one from the list.
any help?
Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new p_skin[33][32]
new const models[] = {
"player/gign/gign.mdl",
"player/gsg9/gsg9.mdl",
"player/sas/sas.mdl",
"player/spetsnaz/spetsnaz.mdl",
};
public plugin_init()
{
	register_plugin("imerge","1","man_s_our")
	register_concmd("imerge", "imerge",0)
	return PLUGIN_CONTINUE
}

public imerge(id)
{
	get_user_info(id,"model",p_skin[id],31);
	new mod = random(3);
	new model = models[mod];
	cs_set_user_model(id, models[mod])
	return PLUGIN_CONTINUE
}
public new_round(id)
{ 
	cs_set_user_model(id, p_skin[id])
}

Last edited by man_s_our; 03-25-2018 at 19:26.
man_s_our is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 08-19-2017 , 09:32   Re: unkown code error
Reply With Quote #2

I think you need to check whether player is alive. function new_round() is not registered anywhere, so it cannot be called. You need to hook player spawn and then change it from there. all in all, it should look something like this:
Spoiler


as in model array:
PHP Code:
new const models[] = {
"player/gign/gign.mdl",
"player/gsg9/gsg9.mdl",
"player/sas/sas.mdl",
"player/spetsnaz/spetsnaz.mdl",
};
//this is incorrect, you need to write only a folder directory for a model.
//that is a case only for a player models tho 
this should be instead:
PHP Code:
new models[4][] = {
    
"player/gign",
"player/gsg9",
"player/sas",
"player/spetsnaz"

__________________
retired chump

Last edited by DjSoftero; 08-19-2017 at 10:56.
DjSoftero is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 08-19-2017 , 12:35   Re: unkown code error
Reply With Quote #3

Quote:
Originally Posted by DjSoftero View Post
I think you need to check whether player is alive. function new_round() is not registered anywhere, so it cannot be called. You need to hook player spawn and then change it from there. all in all, it should look something like this:
Spoiler


as in model array:
PHP Code:
new const models[] = {
"player/gign/gign.mdl",
"player/gsg9/gsg9.mdl",
"player/sas/sas.mdl",
"player/spetsnaz/spetsnaz.mdl",
};
//this is incorrect, you need to write only a folder directory for a model.
//that is a case only for a player models tho 
this should be instead:
PHP Code:
new models[4][] = {
    
"player/gign",
"player/gsg9",
"player/sas",
"player/spetsnaz"

thank you
man_s_our is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 08-20-2017 , 09:17   Re: unkown code error
Reply With Quote #4

unfortunately it didn't compile.
so I replaced the disguise with transparency.
man_s_our is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-20-2017 , 15:14   Re: unkown code error
Reply With Quote #5

Here you go...

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

new p_skin[33][32]

new const 
models[][] = {
"gign",
"gsg9",
"sas",
"spetsnaz"
}

public 
plugin_precache()
{
       new 
szText[64]

       for(new 
sizeof modelsi++) {
                  
formatex(szText63"models/player/%s/%s.mdl"models[i], models[i])
                  
precache_model(szText)
formatex(szText63"models/player/%s/%sT.mdl"models[i], models[i])
                  
precache_model(szText)
           }
}

public 
plugin_init()
{
    
register_plugin("imerge","1","man_s_our")
    
register_concmd("imerge""imerge",0)
        
RegisterHam(Ham_Spawn"player""fw_player_spawned"1)
        
RegisterHam(Ham_Respawn"player""fw_player_spawned"1)
}

public 
imerge(id)
{
        
formatex(p_skin[id], charsmax(p_skin[]),models[random(sizeof models)])
    
set_user_info(id,"model",p_skin[id])
    
cs_set_user_model(idp_skin[id])
}
public 
fw_player_spawned(id)

        if(!
is_user_alive(id)) return;
        
set_user_info(id,"model",p_skin[id])
    
cs_set_user_model(idp_skin[id])

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-20-2017 at 15:26.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
kristi
Senior Member
Join Date: Nov 2016
Old 08-20-2017 , 15:52   Re: unkown code error
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
Spoiler
http://amxmodx.org/api/ham_const
Code:
/**
     * Description:     Normally called when a map-based item respawns, such as a health kit or something.
     * Forward params:  function(this);      * Return type:     Entity.      * Execute params:  ExecuteHam(Ham_Respawn, this);      */     Ham_Respawn,

So it is probably not called for players.
kristi is offline
Send a message via Skype™ to kristi
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 08-20-2017 , 17:10   Re: unkown code error
Reply With Quote #7

thank you all for your help
man_s_our is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-20-2017 , 17:26   Re: unkown code error
Reply With Quote #8

Quote:
Originally Posted by kristi View Post
http://amxmodx.org/api/ham_const
Code:
/**
     * Description:     Normally called when a map-based item respawns, such as a health kit or something.
     * Forward params:  function(this);      * Return type:     Entity.      * Execute params:  ExecuteHam(Ham_Respawn, this);      */     Ham_Respawn,

So it is probably not called for players.
why dont test?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 08-21-2017 , 01:41   Re: unkown code error
Reply With Quote #9

Quote:
Originally Posted by man_s_our View Post
unfortunately it didn't compile.
so I replaced the disguise with transparency.
it didnt compile the code I gave you, or after you edited it? I`m asking because i always test my stuff and your compiler could be outdated.
__________________
retired chump
DjSoftero is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 08-21-2017 , 19:10   Re: unkown code error
Reply With Quote #10

Quote:
Originally Posted by DjSoftero View Post
it didnt compile the code I gave you, or after you edited it? I`m asking because i always test my stuff and your compiler could be outdated.
that code itself
man_s_our is offline
Reply


Thread Tools
Display Modes

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 13:03.


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