AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bot Name (https://forums.alliedmods.net/showthread.php?t=50576)

Blue One 01-29-2007 14:02

Bot Name
 
Hey all Modders i need some help for my DOD Xp script..

i created an function that shows up the name of the People who u killed , and shows his name when he killed you like this :

\/ you Killed him \/

--- You killed Blue One ---

\/ he Kills you \/

--- You was been killed by Blue One ---

______________________________________

and now my question can i display bot names ? i Know only that it works because my brother and me tested it and when he kills me it shows up but when a bot kills me nothing .....

Please help me

XxAvalanchexX 01-30-2007 00:24

Re: Bot Name
 
get_user_name should work on a bot. We would need to see your code to find out where the problem is.

Blue One 01-30-2007 10:46

Re: Bot Name
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <dodx>
#include <dodfun>
#include <fun>
#include <vault>

#define CLASS_NOTHING 0
#define CLASS_AMAZONE 1
#define CLASS_ASSASINE 2
#define CLASS_NECROMANCER 3
#define CLASS_BARBARIAN 4
#define CLASS_PALADIN 5
#define CLASS_SORCERESS 6
#define CLASS_DRUID 7

#define MAXCLASSES 8

new PlayerClass[33]
new PlayerXP[33]
new PlayerLevel[33]

new const CLASSES[MAXCLASSES][] = {
    "None",
    "Amazone",
    "Assasine",
    "Necromancer",
    "Barbarian",
    "Paladin",
    "Sorceress",
    "Druid"
}

//new msgtext

new const LEVELS[10] = {
        0,
        100,
        200,
        300,
        400,
        500,
        600,
        700,
        800,
        900
}

public plugin_init()
{
    register_plugin("Diablo Mod", "1.0", "Nobodykillsme")
   
    register_cvar("sv_diablo", "1")
   
    register_event("DeathMsg", "DeathMsg", "a", "1>0")
   
    register_cvar("XP_per_kill", "10")
   
    register_menucmd(register_menuid("menu_ChooseChar"),1023,"DoChooseChar");
   
    register_event("ResetHUD", "ResetHUD", "b")
   
    //msgtext = get_user_msgid("StatusText")
    register_clcmd("say /diablohud", "ShowHUD")
    register_clcmd("say_team /diablohud", "ShowHUD")
    register_clcmd("say /changeclass", "reselect")
    register_clcmd("say_team /changeclass", "reselect")
    register_logevent("dod_client_spawn",2,"1=Round_Start") 
    register_logevent("dod_client_spawn",2,"1=killed")
}
//public client_connect(id)
//{
//    new name[32]
//    get_user_info(id, "name", name, 31)
//    set_hudmessage(200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2)
//    show_hudmessage(0, "%s has Entered",name)
//}
public  dod_client_spawn ( id )
{
        if(PlayerClass[id] == CLASS_AMAZONE) {
                if(PlayerLevel[id] == 2) {
                        set_user_maxspeed(id,650)
                        set_user_gravity(id,650)
                }
        }
}
public reselect(id)
{
        downgrade(id)
        ChooseChar(id)
}
public downgrade(id) {
        set_user_maxspeed(id,500)
        set_user_gravity(id,800)
        PlayerLevel[id] = 0
        PlayerXP[id] = 0
}
stock ChooseChar(id)
{
    new menu[192]
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6

   
    format(menu, 191, "Diablo Mod: Choose Character^n^n1. Amazone^n2. Assasine^n3. Necromancer^n4. Barbarian^n5. Paladin^n6. Sorceress^n7. Druid^n^n0. Exit")
    show_menu(id, keys, menu, -1, "menu_ChooseChar")   
    return PLUGIN_CONTINUE
}

public DoChooseChar(id, key)
{
    if(key == 0) {
     
        if(PlayerClass[id] == CLASS_AMAZONE) {
       

              client_print(id, print_chat, "[Diablo Mod] You are allready a Amazone! Choose something else!")
              ChooseChar(id)         
              return PLUGIN_HANDLED
        }       

        PlayerClass[id] = CLASS_AMAZONE       
        client_print(id, print_chat, "[Diablo Mod] You are now a Amazone!")
    }       
       
    if(key == 1) {
       
        if(PlayerClass[id] == CLASS_ASSASINE) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Assasine! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_ASSASINE
        client_print(id, print_chat, "[Diablo Mod] You are now a Assasine!")
    }
   
    if(key == 2) {
       
        if(PlayerClass[id] == CLASS_NECROMANCER) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Necromancer! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_NECROMANCER
        client_print(id, print_chat, "[Diablo Mod] You are now a Necromancer!")
    }   

    if(key == 3) {
       
        if(PlayerClass[id] == CLASS_BARBARIAN) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Bararian! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_BARBARIAN
        client_print(id, print_chat, "[Diablo Mod] You are now a Barbarian!")
    }
    if(key == 4) {
       
        if(PlayerClass[id] == CLASS_PALADIN) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Paladin! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_PALADIN
        client_print(id, print_chat, "[Diablo Mod] You are now a Paladin!")
    }
    if(key == 5) {
       
        if(PlayerClass[id] == CLASS_SORCERESS) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Sorceress! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_SORCERESS
        client_print(id, print_chat, "[Diablo Mod] You are now a Sorceress!")
    }
    if(key == 6) {
       
        if(PlayerClass[id] == CLASS_DRUID) {
             
              client_print(id, print_chat, "[Diablo Mod] You are allready a Druid! Choose something else!")
              ChooseChar(id)
              return PLUGIN_HANDLED
        }
                 
        PlayerClass[id] = CLASS_DRUID
        client_print(id, print_chat, "[Diablo Mod] You are now a Druid!")
    }
     
    ShowHUD(id)
   
    return PLUGIN_HANDLED
}

public ResetHUD(id)
{
    if(PlayerClass[id] == CLASS_NOTHING) {
   
        ChooseChar(id)
        return PLUGIN_HANDLED
    }
   
    return PLUGIN_HANDLED
}

public DeathMsg(msgid)
{
    if(get_cvar_num("sv_diablo") == 0) {
        return PLUGIN_HANDLED
    }
   
    new attacker = read_data(1)
    new victim = read_data(2)
    new attacker_name[100]
    get_user_info(attacker,"name",attacker_name,99)
    new victim_name[100]
    get_user_info(victim,"name",victim_name,99)
    //new weapon = read_data(4)
    if(PlayerClass[attacker] == CLASS_NOTHING) {
        return PLUGIN_HANDLED
    }
   
    if(PlayerLevel[attacker] == 10) {
        return PLUGIN_HANDLED
    }
           
    PlayerXP[attacker] += get_cvar_num("XP_per_kill")
   
    if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
   
        PlayerLevel[attacker] += 1
       
        client_print(attacker, print_chat, "[Diablo Mod] Congratulations! You are now level %i!", PlayerLevel[attacker])
        ShowHUD(attacker)
    } 
   
    ShowHUD(attacker)
    client_print(attacker,print_center,"--- you killed %s ---",victim_name)
    client_print(victim,print_center,"--- You was been killed from %s ---",attacker_name)
    return PLUGIN_CONTINUE
}

public ShowHUD(id)   
{
set_hudmessage(255, 255, 255, -1.0, 0.9, 0, 6.0, 12.0)
show_hudmessage(id, "[%s] |Level %i | XP %i",CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id])
}

This is my code hmm hope you can help me and maybe u can gimme some Ideas for my Mod ;)

organizedKaoS 01-30-2007 14:52

Re: Bot Name
 
Code:
new kname[32], vname[32] get_user_name(killer, kname, 31) get_user_name(victim, vname, 31)

That will return bot names.

I would guess your problem lies in the get_user_info part.

Since bots dont have the same client info structures as real players.

Blue One 01-30-2007 16:28

Re: Bot Name
 
I Got it now Guys i take it so look at my Code , and that works Fine thanks for your Help organizedKaoS

Code:

public client_death ( killer, victim, wpnindex, hitplace, TK)
{
        new name_of_attacker[100]
        get_user_name(killer,name_of_attacker,99)
        set_hudmessage(0, 255, 255, -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(victim,"--- You was been killed from %s ---",name_of_attacker)
}



All times are GMT -4. The time now is 00:35.

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