AlliedModders

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

ProIcons 06-19-2009 03:54

Problem
 
Code:

new IPz;
public  client_connect(id)
{
    new name[32]
    new auth[50]
    new Newname;
    get_user_ip(id, auth, 49, 0)
    get_user_ip(id, IPz, 49, 0)
    IPz = auth[49]
    get_user_name(id, name, 31)
    log_message("IP of %s %s = %s 1 %s 2", name, id, auth, IPz)
    if (get_cvar_num("ip_1") == IPz)
    {   
       
        Newname = get_cvar_num("player_1")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_2") == IPz) {
       
        Newname = get_cvar_num("player_2")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_3") == IPz) {
       
        Newname = get_cvar_num("player_3")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_4") == IPz) {
       
        Newname = get_cvar_num("player_4")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_5") == IPz) {
       
        Newname = get_cvar_num("player_5")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_6") == IPz) {
       
        Newname = get_cvar_num("player_6")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_7") == IPz) {
       
        Newname = get_cvar_num("player_7")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_8") == IPz) {
       
        Newname = get_cvar_num("player_8")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_9") == IPz) {
       
        Newname = get_cvar_num("player_9")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    } else if (get_cvar_num("ip_10") == IPz) {
       
        Newname = get_cvar_num("player_10")
        client_cmd(id, "name ^"%s^"", Newname)
        return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

Well i Have done this script...
But I Doesn't work. I made this script to give a specific Nick on each player.
. Well
player_1 == ProIcons
ip_1 == 192.168.1.64 (Local Ip)
if (Ip Of the connected player == ip_1) { changenick From Player to nick Player_1 }
if (192.168.1.64 == ip_1) { changenick From Player to ProIcons }

et cetera..

Sylwester 06-19-2009 04:45

Re: Problem
 
The way you did it totally suck.
You should create some database (file, vault or sql) and retrieve names from there.

PHP Code:

#include <amxmodx>

#define MAX_PLAYERS 32
new g_name[MAX_PLAYERS 1][32]
new 
bool:g_lock_name[MAX_PLAYERS 1]


public 
change_player_name(id){
    
//this function must change player name to g_name[id]
}

public 
client_infochanged(id){ //called when player changes name
    
new name[32]
    
get_user_info(id"name"name31)
    if(
g_lock_name[id] && !equals(nameg_name[id]))
        
change_player_name(id)
}

public 
load_name(id){
    new 
ip[32]
    
get_user_ip(idip31)
    
//now using ip retrieve player name from database
    //and store it in g_name[id]
    //if name was found in database then
    //g_lock_name[id] = true
}

public 
client_connect(id){
    
g_lock_name[id] = false
    load_name
(id)
    if(
g_lock_name[id])
        
change_player_name(id)



ProIcons 06-19-2009 05:01

Re: Problem
 
well i don't know a lot of pawn...I am doing this script for my channel (gather channel)
max players = 10 - 12
well When a gather starts on irc bot will set cvars with rcon Player1 and his ip et cetera...
I want every player to have irc nick on Counter Strike server...
Could you make it for me please? i don't know a lot from Pawn... I am from Greece and i am ONLY 14 Years old... I don't know Very well english..

Sylwester 06-19-2009 05:20

Re: Problem
 
If you want players to have same names on your server as on irc channel then there is other way:
You can create irc bot with amxx, so when you start the server, amxx irc bot will connect to your irc channel and when player connects to server, then bot will check if there is user on irc with same ip and change player name to irc name if user with same ip was found.

Coding such plugin would take me some time and I don't really feel like doing it right now (I have some other plugins to code). If you can't do it yourself then post in suggestion/requests instead of scripting help.


All times are GMT -4. The time now is 15:28.

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