Raised This Month: $32 Target: $400
 8% 

[Help] Need Help Fast!!!!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 08-30-2011 , 02:33   [Help] Need Help Fast!!!!!
Reply With Quote #1

Hey guys, this gave me an error about MSG ONE AND RELIABLE Not Finding Target Entity.

Which I Cant Find The Error.

Code.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>

new const SETTING_FILE[] = "csaw_player.ini"

const MAX_PLAYER 100

new csaw_player_name[MAX_PLAYER][32]

new 
csaw_player_classmodel1[MAX_PLAYER][32]
new 
csaw_player_classmodel2[MAX_PLAYER][32]
new 
csaw_player_classmodel3[MAX_PLAYER][32]
new 
csaw_player_classmodel4[MAX_PLAYER][32]
new 
csaw_player_classmodel5[MAX_PLAYER][32]

new 
csaw_player_model1_index[MAX_PLAYER]
new 
csaw_player_model2_index[MAX_PLAYER]
new 
csaw_player_model3_index[MAX_PLAYER]
new 
csaw_player_model4_index[MAX_PLAYER]
new 
csaw_player_model5_index[MAX_PLAYER]

new 
csaw_player_sex[MAX_PLAYER]

new 
csaw_player_team[MAX_PLAYER]

new 
csaw_player_hp1[MAX_PLAYER]
new 
csaw_player_hp2[MAX_PLAYER]
new 
csaw_player_hp3[MAX_PLAYER]
new 
csaw_player_hp4[MAX_PLAYER]
new 
csaw_player_hp5[MAX_PLAYER]

new 
csaw_player_ap1[MAX_PLAYER]
new 
csaw_player_ap2[MAX_PLAYER]
new 
csaw_player_ap3[MAX_PLAYER]
new 
csaw_player_ap4[MAX_PLAYER]
new 
csaw_player_ap5[MAX_PLAYER]

new 
csaw_player_spd1[MAX_PLAYER]
new 
csaw_player_spd2[MAX_PLAYER]
new 
csaw_player_spd3[MAX_PLAYER]
new 
csaw_player_spd4[MAX_PLAYER]
new 
csaw_player_spd5[MAX_PLAYER]

new 
csaw_set_model_indexcsaw_modelindex_default,csaw_player_total
csaw_sex[33], csaw_idplayer[33],csaw_class[33], csaw_team[33]

new 
data_name[64], data_model1[64],data_model2[64],data_model3[64],data_model4[64],data_model5[64], data_teamdata_sex,
data_hp1data_hp2data_hp3data_hp4data_hp5data_ap1data_ap2data_ap3data_ap4data_ap5,
data_spd1data_spd2data_spd3data_spd4data_spd5

new csaw_saytextmsgcsaw_freezetime

new csaw_dir_model[64] = "models/player/%s/%s.mdl"

new autoselect[] = "autoselect"

enum (+= 100)
{
    
TASK_WELCOME 2000
}

enum
{
    
FM_CS_TEAM_UNASSIGNED 0,
    
FM_CS_TEAM_T,
    
FM_CS_TEAM_CT,
    
FM_CS_TEAM_SPECTATOR
}

enum
{
    
CSAW_CLASS1 0,
    
CSAW_CLASS2,
    
CSAW_CLASS3,
    
CSAW_CLASS4,
    
CSAW_CLASS5
}

new const 
SOUND_F_BHIT[3][] = 

    
"csaw_player/f_bhit_flesh-1.wav",
    
"csaw_player/f_bhit_flesh-2.wav",
    
"csaw_player/f_bhit_flesh-3.wav"
}

new const 
SOUND_F_DIE[3][] =
{
    
"csaw_player/f_die1.wav",
    
"csaw_player/f_die2.wav",
    
"csaw_player/f_die3.wav"
}

new const 
SOUND_F_HS[3][] = 

    
"csaw_player/f_headshot1.wav",
    
"csaw_player/f_headshot2.wav",
    
"csaw_player/f_headshot3.wav"
}

new const 
SOUND_SAFDEATH[1][] = 

    
"csaw_player/saf_death.wav"
}

enum
{
    
SECTION_NAME 0,
    
SECTION_CLASSMODEL1,
    
SECTION_CLASSMODEL2,
    
SECTION_CLASSMODEL3,
    
SECTION_CLASSMODEL4,
    
SECTION_CLASSMODEL5,
    
SECTION_CLASSHP1,
    
SECTION_CLASSHP2,
    
SECTION_CLASSHP3,
    
SECTION_CLASSHP4,
    
SECTION_CLASSHP5,
    
SECTION_CLASSAP1,
    
SECTION_CLASSAP2,
    
SECTION_CLASSAP3,
    
SECTION_CLASSAP4,
    
SECTION_CLASSAP5,
    
SECTION_CLASSSPD1,
    
SECTION_CLASSSPD2,
    
SECTION_CLASSSPD3,
    
SECTION_CLASSSPD4,
    
SECTION_CLASSSPD5,
    
SECTION_TEAM,
    
SECTION_SEX
}

const 
OFFSET_LINUX 5
const OFFSET_MODELINDEX 491

public plugin_natives()
{    
    
register_native("csaw_set_user_model""natives_set_user_model"1)
    
register_native("csaw_set_user_model_index""natives_set_user_model_index"1)
    
register_native("csaw_reset_user_model""natives_reset_user_model"1)
    
register_native("csaw_reset_user_model_index""natives_reset_user_model_index"1)
    
register_native("csaw_get_user_sex""natives_get_user_sex"1)
    
register_native("csaw_set_user_sex""natives_set_user_sex"1)
    
register_native("csaw_get_user_team""natives_get_user_team"1)
    
register_native("csaw_create_user_sound_bhit""natives_create_user_sound_bhit"1)
    
}
public 
plugin_init()
{
    
register_plugin("[CSAW] Player""1.0""NST, jc980")
    
    
register_dictionary("csaw_player.txt")
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
register_logevent("logevent_round_start",2"1=Round_Start")
    
    
register_forward(FM_EmitSound"fw_EmitSound")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
    
register_clcmd("csaw_choose_player""cmd_choose_player")
    
register_clcmd("csaw_player""cmd_menu_main")
    
register_clcmd("csaw_playerclass""menu_playerclass")
    
    
csaw_saytextmsg get_user_msgid("SayText")
}

public 
plugin_precache()
{
    
load_config()
    
    for (new 
0<= 2i++)
    {
        
engfunc(EngFunc_PrecacheSoundSOUND_F_BHIT[i])
        
engfunc(EngFunc_PrecacheSoundSOUND_F_DIE[i])
        
engfunc(EngFunc_PrecacheSoundSOUND_F_HS[i])
    }
    
    for (new 
0<= 1i++)
    {
        
engfunc(EngFunc_PrecacheSoundSOUND_SAFDEATH[i])
    }    
    
    
csaw_modelindex_default engfunc(EngFunc_PrecacheModel"models/player/leet/leet.mdl")
}

load_config()
{
    new 
path[64]
    
    
get_configsdir(pathcharsmax(path))
    
    
format(pathcharsmax(path), "%s/%s"pathSETTING_FILE)
    
    if (!
file_exists(path))
    {
        new 
error[100]
        
        
formatex(errorcharsmax(error), "Cannot Load Customization File %s!"path)
        
set_fail_state(error)
        
        return
    }
    
    new 
linedata[1024], key[64], value[1024], key2[64], value2[960]
    
    new 
file fopen(path"rt")
    
    new 
idplayer 1
    
    
while (file && !feof(file))
    {
        
fgets(filelinedatacharsmax(linedata))
        
        
replace(linedatacharsmax(linedata), "^n""")
        
        if (!
linedata[0] || linedata[0] == ';'
            continue
        
        
strtok(linedatakey2charsmax(key2), value2charsmax(value2), '=')
        
        
trim(key2)
        
trim(value2)
        
        if (
equal(key2"SET_MODEL_INDEX"))
        {
            
csaw_set_model_index str_to_num(value2)
            
            continue
        }
        
        
replace(linedatacharsmax(linedata), ",""")
        
replace(linedatacharsmax(linedata), "[name]"",")
        
replace(linedatacharsmax(linedata), "[model1]"",")
        
replace(linedatacharsmax(linedata), "[model2]"",")
        
replace(linedatacharsmax(linedata), "[model3]"",")
        
replace(linedatacharsmax(linedata), "[model4]"",")
        
replace(linedatacharsmax(linedata), "[model5]"",")
        
replace(linedatacharsmax(linedata), "[hp1]"",")
        
replace(linedatacharsmax(linedata), "[hp2]"",")
        
replace(linedatacharsmax(linedata), "[hp3]"",")
        
replace(linedatacharsmax(linedata), "[hp4]"",")
        
replace(linedatacharsmax(linedata), "[hp5]"",")
        
replace(linedatacharsmax(linedata), "[ap1]"",")
        
replace(linedatacharsmax(linedata), "[ap2]"",")
        
replace(linedatacharsmax(linedata), "[ap3]"",")
        
replace(linedatacharsmax(linedata), "[ap4]"",")
        
replace(linedatacharsmax(linedata), "[ap5]"",")
        
replace(linedatacharsmax(linedata), "[spd1]"",")
        
replace(linedatacharsmax(linedata), "[spd2]"",")
        
replace(linedatacharsmax(linedata), "[spd3]"",")
        
replace(linedatacharsmax(linedata), "[spd4]"",")
        
replace(linedatacharsmax(linedata), "[spd5]"",")
        
replace(linedatacharsmax(linedata), "[team]"",")
        
replace(linedatacharsmax(linedata), "[sex]"",")

        
strtok(linedatakeycharsmax(key), valuecharsmax(value), ',')
        
        new 
i
        
        
while (value[0] != && strtok(valuekeycharsmax(key), valuecharsmax(value), ','))
        {
            switch (
i)
            {
                case 
SECTION_NAMEformat(data_namecharsmax(data_name), "%s"key)
                case 
SECTION_CLASSMODEL1format(data_model1charsmax(data_model1), "%s"key)
                case 
SECTION_CLASSMODEL2format(data_model2charsmax(data_model2), "%s"key)
                case 
SECTION_CLASSMODEL3format(data_model3charsmax(data_model3), "%s"key)
                case 
SECTION_CLASSMODEL4format(data_model4charsmax(data_model4), "%s"key)
                case 
SECTION_CLASSMODEL5format(data_model5charsmax(data_model5), "%s"key)
                case 
SECTION_CLASSHP1data_hp1 str_to_num(key)
                case 
SECTION_CLASSHP2data_hp2 str_to_num(key)
                case 
SECTION_CLASSHP3data_hp3 str_to_num(key)
                case 
SECTION_CLASSHP4data_hp4 str_to_num(key)
                case 
SECTION_CLASSHP5data_hp5 str_to_num(key)
                case 
SECTION_CLASSAP1data_ap1 str_to_num(key)
                case 
SECTION_CLASSAP2data_ap2 str_to_num(key)
                case 
SECTION_CLASSAP3data_ap3 str_to_num(key)
                case 
SECTION_CLASSAP4data_ap4 str_to_num(key)
                case 
SECTION_CLASSAP5data_ap5 str_to_num(key)
                case 
SECTION_CLASSSPD1data_spd1 str_to_num(key)
                case 
SECTION_CLASSSPD2data_spd2 str_to_num(key)
                case 
SECTION_CLASSSPD3data_spd3 str_to_num(key)
                case 
SECTION_CLASSSPD4data_spd4 str_to_num(key)
                case 
SECTION_CLASSSPD5data_spd5 str_to_num(key)
                case 
SECTION_TEAMdata_team str_to_num(key)
                case 
SECTION_SEXdata_sex str_to_num(key)
            }
            
i++
        }
        
        new 
modelurl1[64], modelurl2[64], modelurl3[64], modelurl4[64], modelurl5[64]
        
        
format(csaw_player_name[idplayer], 31"%s"data_name)
        
format(csaw_player_classmodel1[idplayer], 31"%s"data_model1)
        
format(csaw_player_classmodel2[idplayer], 31"%s"data_model2)
        
format(csaw_player_classmodel3[idplayer], 31"%s"data_model3)
        
format(csaw_player_classmodel4[idplayer], 31"%s"data_model4)
        
format(csaw_player_classmodel5[idplayer], 31"%s"data_model5)
        
        
format(modelurl1charsmax(modelurl1), csaw_dir_modeldata_model1data_model1)
        
format(modelurl2charsmax(modelurl2), csaw_dir_modeldata_model2data_model2)
        
format(modelurl3charsmax(modelurl3), csaw_dir_modeldata_model3data_model3)
        
format(modelurl4charsmax(modelurl4), csaw_dir_modeldata_model4data_model4)
        
format(modelurl5charsmax(modelurl5), csaw_dir_modeldata_model5data_model5)
        
        
csaw_player_model1_index[idplayer] = precache_model(modelurl1)
        
csaw_player_model2_index[idplayer] = precache_model(modelurl2)
        
csaw_player_model3_index[idplayer] = precache_model(modelurl3)
        
csaw_player_model4_index[idplayer] = precache_model(modelurl4)
        
csaw_player_model5_index[idplayer] = precache_model(modelurl5)
        
        
csaw_player_hp1[idplayer] = data_hp1
        csaw_player_hp2
[idplayer] = data_hp2
        csaw_player_hp3
[idplayer] = data_hp3
        csaw_player_hp4
[idplayer] = data_hp4
        csaw_player_hp5
[idplayer] = data_hp5
        
        csaw_player_ap1
[idplayer] = data_ap1
        csaw_player_ap2
[idplayer] = data_ap2
        csaw_player_ap3
[idplayer] = data_ap3
        csaw_player_ap4
[idplayer] = data_ap4
        csaw_player_ap5
[idplayer] = data_ap5
        
        csaw_player_spd1
[idplayer] = data_spd1
        csaw_player_spd2
[idplayer] = data_spd2
        csaw_player_spd3
[idplayer] = data_spd3
        csaw_player_spd4
[idplayer] = data_spd4
        csaw_player_spd5
[idplayer] = data_spd5
        
        csaw_player_team
[idplayer] = data_team
        
        csaw_player_sex
[idplayer] = data_sex
        
        csaw_player_total 
idplayer
        
        idplayer
++
    }
}

public 
event_round_start()
{
    
remove_task(TASK_WELCOME)
    
    
set_task(10.0"welcome"TASK_WELCOME)
    
set_task(5.0"class")
    
    
csaw_freezetime 1
    
    set_model_new_round
()
}

public 
logevent_round_start()
{
    
csaw_freezetime 0
}

public 
welcome()
{
    new 
message[64]
    
    
format(messagecharsmax(message), "^x04[CSAW] ^x03Player^x04:^x01 %L"LANG_PLAYER"CSAW_HELP_CHOOSE")
    
color_saytext(0message)

    
remove_task(TASK_WELCOME)
    
set_task(60.0"welcome"TASK_WELCOME)
}

public class()
{
    new 
message[64]
        
    for (new 
id 1id 33id++)
    {
        
menu_playerclass(id)
            
        
format(messagecharsmax(message), "^x04[CSAW] ^x03Player^x04:^x01 %L"LANG_PLAYER"CSAW_CLASS_CHOOSE")
        
color_saytext(idmessage)
    }
}

public 
client_putinserver(id)
{
    
reset_value(id)
}

public 
fw_ClientDisconnect(id)
{
    
reset_value(id)
}

public 
fw_EmitSound(idchannel, const sample[], Float:volumeFloat:attnflagspitch)
{
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED
    
    
if (csaw_sex[id] != 2
        return 
FMRES_IGNORED
        
    
new sound[101]
    
    for (new 
0<= 2i++)
    {
        
format(soundcharsmax(sound), "%s"SOUND_F_BHIT[i])
        
replace(soundcharsmax(sound), "csaw_player/f_""player/")
        
        if (
equal(samplesound))
        {
            
emit_sound(idchannelSOUND_F_BHIT[i], volumeattnflagspitch)
            
            return 
FMRES_SUPERCEDE
        
}
        
        
format(soundcharsmax(sound), "%s"SOUND_F_DIE[i])
        
replace(soundcharsmax(sound), "csaw_player/f_""player/")
        
        if (
equal(samplesound))
        {
            
emit_sound(idchannelSOUND_F_DIE[i], volumeattnflagspitch)
            
            return 
FMRES_SUPERCEDE
        
}
        
        
format(soundcharsmax(sound), "%s"SOUND_F_HS[i])
        
replace(soundcharsmax(sound), "csaw_player/f_""player/")
        
        if (
equal(samplesound))
        {
            
emit_sound(idchannelSOUND_F_HS[i], volumeattnflagspitch)
            
            if(
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
emit_death(id)
            }
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    for (new 
0<= 1i++)
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
format(soundcharsmax(sound), "%s"SOUND_SAFDEATH[i])
            
replace(soundcharsmax(sound), "csaw_player/""player/")
            
            if (
equal(samplesound))
            {
                
emit_sound(idchannelSOUND_SAFDEATH[i], volumeattnflagspitch)
                
                return 
FMRES_SUPERCEDE
            
}
        }
    }
    
    return 
FMRES_IGNORED
}

emit_death(id)
{
    new 
random_num(1charsmax(SOUND_SAFDEATH))
    
    
emit_sound(idCHAN_BODYSOUND_SAFDEATH[i], 1.0ATTN_NORM0PITCH_NORM)
    
    return 
PLUGIN_CONTINUE
}

public 
fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id) || csaw_freezetime
        return
    
    new 
Floatmaxspeed
    
new idplayer csaw_idplayer[id]
        
    switch(
csaw_class[id])
    {
        case 
1maxspeed float(csaw_player_spd1[idplayer])
        case 
2maxspeed float(csaw_player_spd2[idplayer])
        case 
3maxspeed float(csaw_player_spd3[idplayer])
        case 
4maxspeed float(csaw_player_spd4[idplayer])
        case 
5maxspeed float(csaw_player_spd5[idplayer])
    }
        
    
set_pev(idpev_maxspeedmaxspeed)
}  

public 
cmd_choose_player(id)
{
    if (!
is_user_connected(id)) 
        return 
PLUGIN_HANDLED
    
    
new name[64]
    
    
read_argv(1name63)
    
    for(new 
i=1i<= csaw_player_totali++)
    {
        if (
csaw_player_sex[i]>0)
        {
            
set_player_class(idirandom_num(1,5))
                        
            return 
PLUGIN_HANDLED
        
}
    }

    if (
equali(nameautoselect))
    {
        new 
idplayer get_random_class(get_user_team(id))
        
        if (
idplayer
            
set_player_class(ididplayerrandom_num(1,5))
    }

    return 
PLUGIN_HANDLED
}

public 
cmd_menu_main(id)
{    
    if (!
is_user_alive(id)) 
        return 
PLUGIN_HANDLED
    
    
new menu_title[64], item_1[64], item_2[64]
    
    
format(menu_titlecharsmax(menu_title), "[CSAW] Player: %L"LANG_PLAYER"MENUTEAM_TITLE")
    
format(item_1charsmax(item_1), "%L"LANG_PLAYER"MENUTEAM_ITEM_TE")
    
format(item_2charsmax(item_2), "%L"LANG_PLAYER"MENUTEAM_ITEM_CT")

    new 
mHandleID menu_create(menu_title"menu_main_handler")
    
    
menu_additem(mHandleIDitem_1"1"0)
    
menu_additem(mHandleIDitem_2"2"0)
    
menu_display(idmHandleID0
    
    return 
PLUGIN_HANDLED
}

public 
menu_main_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    if (
item == 0
        
menu_class(idFM_CS_TEAM_T)
    else 
        if (
item == 1
            
menu_class(idFM_CS_TEAM_CT)
    
    
menu_destroy(menu)
    
    return 
PLUGIN_HANDLED
}

public 
menu_class(idteam)
{
    new 
menu_title[64]
    
    
format(menu_titlecharsmax(menu_title), "[CSAW] Player: %L"LANG_PLAYER"MENUPLAYER_TITLE")

    new 
mHandleID menu_create(menu_title"menu_class_handler")
    
    for (new 
i=1i<= csaw_player_totali++)
    {
        if (
csaw_player_team[i]==team)
        {
            new 
idplayer[32], nameplayer[32]
            
            
format(nameplayercharsmax(nameplayer), "%s"csaw_player_name[i])
            
format(idplayercharsmax(idplayer), "%i"i)
            
            
menu_additem(mHandleIDnameplayeridplayer0)
        }
    }
    
    
menu_display(idmHandleID0)
   
    return 
PLUGIN_HANDLED
}

public 
menu_class_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
idplayer_str[32], nameplayer_str[32], access
    
    menu_item_getinfo
(menuitemaccessidplayer_str31nameplayer_str31access)
    
    new 
idplayer str_to_num(idplayer_str)
    
    
csaw_idplayer[id] = idplayer
    
    menu_playerclass
(id)
    
    
menu_destroy(menu)
    
    return 
PLUGIN_HANDLED
}

public 
menu_playerclass(id)
{
    if (!
is_user_alive(id) || !is_user_connected(id)) 
        return 
PLUGIN_HANDLED
        
    
new menu_title[64]
    
    
format(menu_titlecharsmax(menu_title), "[CSAW] Player: %L"LANG_PLAYER"MENUPLAYERCLASS_TITLE")

    new 
mHandleID menu_create(menu_title"menu_playerclass_handler")
    
    new 
class1[64], class2[64], class3[64], class4[64], class5[64]
        
    
format(class1charsmax(class1), "%L"LANG_PLAYER"PLAYER_CLASS1")
    
format(class2charsmax(class2), "%L"LANG_PLAYER"PLAYER_CLASS2")
    
format(class3charsmax(class3), "%L"LANG_PLAYER"PLAYER_CLASS3")
    
format(class4charsmax(class4), "%L"LANG_PLAYER"PLAYER_CLASS4")
    
format(class5charsmax(class5), "%L"LANG_PLAYER"PLAYER_CLASS5")
        
    
menu_additem(mHandleIDclass1"1"0)
    
menu_additem(mHandleIDclass2"2"0)
    
menu_additem(mHandleIDclass3"3"0)
    
menu_additem(mHandleIDclass4"4"0)
    
menu_additem(mHandleIDclass5"5"0)
    
    
menu_display(idmHandleID0)
   
    return 
PLUGIN_HANDLED
}

public 
menu_playerclass_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
playerclass_str[32], player_str[32], access
    
    menu_item_getinfo
(menuitemaccessplayerclass_str31player_str31access)
    
    new 
playerclass str_to_num(playerclass_str)
    
    
set_player_class(idcsaw_idplayer[id], playerclass)
    
    
menu_destroy(menu)
    
    return 
PLUGIN_HANDLED
}

set_player_class(ididplayerclasstype)
{
    new 
team get_user_team(id)
    
    if (!
idplayer)
        
idplayer get_random_class(team)
    
    if(!
classtype)
        
classtype random_num(1,5)
    
    else if (
team!=csaw_player_team[idplayer])
    {
        
fm_cs_set_user_team(idcsaw_player_team[idplayer])
        
        if (
is_user_alive(id)) 
            
user_kill(id)
    }

    
set_player_model(ididplayerclasstype)
    
    
set_class_new_round()
    
    new 
msg[101], classmsg[64]
    
    switch(
classtype)
    {
        case 
1format(classmsgcharsmax(classmsg),"%L"LANG_PLAYER"PLAYER_CLASS1")
        case 
2format(classmsgcharsmax(classmsg),"%L"LANG_PLAYER"PLAYER_CLASS2")
        case 
3format(classmsgcharsmax(classmsg),"%L"LANG_PLAYER"PLAYER_CLASS3")
        case 
4format(classmsgcharsmax(classmsg),"%L"LANG_PLAYER"PLAYER_CLASS4")
        case 
5format(classmsgcharsmax(classmsg),"%L"LANG_PLAYER"PLAYER_CLASS5")
    }
    
    
format(msgcharsmax(msg), "^x04[CSAW]^x03 Player^x04:^x01 %L"LANG_PLAYER"NOTICE_CHOOSECLASS_COMPLETE"classmsg)
    
color_saytext(idmsg)
}

set_player_model(ididplayerclasstype)
{
    
csaw_idplayer[id] = idplayer
    csaw_class
[id] = classtype
    csaw_sex
[id] = csaw_player_sex[idplayer]
    
csaw_team[id] = csaw_player_team[idplayer]
    
    switch(
classtype)
    {
        case 
1set_user_model(idcsaw_player_classmodel1[idplayer])
        case 
2set_user_model(idcsaw_player_classmodel2[idplayer])
        case 
3set_user_model(idcsaw_player_classmodel3[idplayer])
        case 
4set_user_model(idcsaw_player_classmodel4[idplayer])
        case 
5set_user_model(idcsaw_player_classmodel5[idplayer])
    }
    
    if (
csaw_set_model_index
    {
        switch(
classtype)
        {
            case 
1set_user_model_index(idcsaw_player_model1_index[idplayer])
            case 
2set_user_model_index(idcsaw_player_model2_index[idplayer])
            case 
3set_user_model_index(idcsaw_player_model3_index[idplayer])
            case 
4set_user_model_index(idcsaw_player_model4_index[idplayer])
            case 
5set_user_model_index(idcsaw_player_model5_index[idplayer])
        }
    }
    else
        
set_user_model_index(idcsaw_modelindex_default)
}

set_user_model(idmodel[])
{
    if (!
is_user_connected(id)) 
        return
    
    new 
model_url[64]
    
    
format(model_urlcharsmax(model_url), csaw_dir_modelmodelmodel)
    
    
cs_set_user_model(idmodel)
    
set_pev(idpev_modelmodel_url)
}

set_user_model_index(idmodel_index)
{
    
fm_cs_set_user_model_index(idmodel_index)
}

reset_user_model(id)
{
    if (!
is_user_connected(id)) 
        return
    
    if (!
csaw_idplayer[id]) 
        
csaw_idplayer[id] = get_random_class(get_user_team(id))
        
    
set_player_model(idcsaw_idplayer[id], random_num(1,5))
}

set_model_new_round()
{
    for (new 
id 1id 33id++)
    {
        if (!
is_user_connected(id)) 
            continue
        
        if (
is_user_bot(id) || !csaw_idplayer[id]) 
            
set_player_class(id00)
        else 
            
set_player_model(idcsaw_idplayer[id], csaw_class[id])
    }
}

set_class_new_round()
{
    for (new 
id 1id 33id++)
    {
        if (!
is_user_connected(id) || !is_user_alive(id)) 
            return
            
        new 
idplayer csaw_idplayer[id]
        
        switch(
csaw_class[id])
        {
            case 
1:
            {
                
set_pev(idpev_healthfloat(csaw_player_hp1[idplayer]))
                
set_pev(idpev_armorvaluefloat(csaw_player_ap1[idplayer]))
            }
            case 
2:
            {
                
set_pev(idpev_healthfloat(csaw_player_hp2[idplayer]))
                
set_pev(idpev_armorvaluefloat(csaw_player_ap2[idplayer]))
            }
            case 
3:
            {
                
set_pev(idpev_healthfloat(csaw_player_hp3[idplayer]))
                
set_pev(idpev_armorvaluefloat(csaw_player_ap3[idplayer]))
            }
            case 
4:
            {
                
set_pev(idpev_healthfloat(csaw_player_hp4[idplayer]))
                
set_pev(idpev_armorvaluefloat(csaw_player_ap4[idplayer]))
            }
            case 
5:
            {
                
set_pev(idpev_healthfloat(csaw_player_hp5[idplayer]))
                
set_pev(idpev_armorvaluefloat(csaw_player_ap5[idplayer]))
            }
        }
    }
}

get_random_class(team)
{
    new 
n_player_idplayer[MAX_PLAYER], totalidrandom
    
    
for (new i=1<= csaw_player_totali++)
    {
        if (
csaw_player_team[i] == team)
        {
            
n_player_idplayer[total+1] = i
            
            total
++
        }
    }
    
    if (
total
        
idrandom n_player_idplayer[random_num(1total)]
    
    return 
idrandom
}

color_saytext(player, const message[], any:...)
{
    new 
text[301]
    
    
format(text300"%s"message)

    new 
dest
    
    
if (player
        
dest MSG_ONE
    
else 
        
dest MSG_ALL
    
    message_begin
(destcsaw_saytextmsg, {0,0,0}, player)
    
    
write_byte(1)
    
    
write_string(check_text(text))
    
    return 
message_end()
}

check_text(text1[])
{
    new 
text[301]
    
    
format(text300"%s"text1)
    
    
replace(text300">x04""^x04")
    
replace(text300">x03""^x03")
    
replace(text300">x01""^x01")
    
    return 
text
}

reset_value(id)
{
    
csaw_idplayer[id] = 0
    csaw_class
[id] = 0
    csaw_sex
[id] = 0
    csaw_team
[id] = 0
}

PlayEmitSound(idtype, const sound[])
{
    
emit_sound(idtypesound1.0ATTN_NORM0PITCH_NORM)
}

stock fm_cs_set_user_team(idteam)
{
    
cs_set_user_team(idteam0)
}
stock fm_cs_set_user_model_index(idvalue)
{
    if (!
value
        return
        
    
set_pdata_int(idOFFSET_MODELINDEXvalueOFFSET_LINUX)
}

public 
natives_get_user_sex(id)
{
    return 
csaw_sex[id]
}
public 
natives_set_user_sex(idsex)
{
    
csaw_sex[id] = sex
    
    
return 1
}
public 
natives_get_user_team(id)
{
    return 
csaw_team[id]
}
public 
natives_set_user_model(idmodel[])
{
    
param_convert(2)
    
    
set_user_model(idmodel)
    
    return 
1
}
public 
natives_reset_user_model(id)
{
    
reset_user_model(id)
    
    return 
1
}
public 
natives_set_user_model_index(idmodelindex)
{
    
set_user_model_index(idmodelindex)
    
    return 
1
}
public 
natives_reset_user_model_index(id)
{
    
set_user_model_index(idcsaw_modelindex_default)
    
    return 
1
}
public 
natives_create_user_sound_bhit(id)
{
    new 
sound[64]
    
    if (
csaw_sex[id]==2
        
format(soundcharsmax(sound), "nst_player/f_bhit_flesh-%i.wav"random_num(13))
    else 
        
format(soundcharsmax(sound), "player/bhit_flesh-%i.wav"random_num(13))
        
    
PlayEmitSound(idCHAN_VOICEsound)

__________________
jc980 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-30-2011 , 09:27   Re: [Help] Need Help Fast!!!!!
Reply With Quote #2

the only MSG_ONE you have there is in the color_saytext() function, and it's triggered only if player is not 0 (can be negative or above 32 tough...) so check all of your calls of color_saytext() and make sure it's first argument can't be below 0 or above maxplayers, if it's 0 leave it alone.
__________________
Hunter-Digital 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 09:07.


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