AlliedModders

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

Rirre 10-07-2007 09:41

Client Connect
 
Problems:
----------
1. Player name (name)
it replaces it with the hostname instead and I don't know why.
hostname, mapname, nextmap, players works perfecly.

2. spk (looked into speech.ini, but it wasn't same did I get when I didn't hear
the sounds in-game, hope you have an solution to get them to work without to do them into 1 .wav file so players don't need to download)

------------
Suggestion:
I can't really make timeleft into it, wonder if you could do it (below nextmap).

Code:

#include <amxmodx>
 
public plugin_init() {
 register_plugin("AMXX Client Connect", "1.0", "Rirre")
 set_task(16.0, "ClientConnect")
 return PLUGIN_CONTINUE
}
 
public ClientConnect(id) {
    new name[32], hostname[64]
    new mapname[32], nextmap[32]
 
    get_cvar_string("hostname",hostname,63)
    get_user_name(id,name,31)
    get_mapname(mapname,31)
    get_cvar_string("amx_nextmap",nextmap,31)
 
    client_cmd(id, ^"spk \'fvox/fuzz fuzz hev_logon\'^")
    set_hudmessage(200,255,0, 0.0, 0.34, 0, 6.0, 15.0)
    show_hudmessage(id, "Hi %s!^nWelcome to %s^nMap: %s^nNextmap: %s^nPlayers: %d/%d",name,hostname,mapname,nextmap,get_playersnum(),get_maxplayers())
    return PLUGIN_CONTINUE
}
 
public plugin_precache() {
    precache_sound("fvox/fuzz.wav")
    precache_sound("fvox/hev_logon.wav")
}


ConnorMcLeod 10-07-2007 09:56

Re: Client Connect
 
In your loop_task, id is 0 = server.
Also you don't need to precache sounds.

Try this :
Code:
#include <amxmodx> new g_maxplayers   public plugin_init() {     register_plugin("AMXX Client Connect", "1.0", "Rirre") } public plugin_cfg() {     g_maxplayers = get_maxplayers() }   public client_putinserver(id) {     new name[32], hostname[64]     new mapname[32], nextmap[32]       get_cvar_string("hostname",hostname,63)     get_user_name(id,name,31)     get_mapname(mapname,31)     get_cvar_string("amx_nextmap",nextmap,31)       client_cmd(id, "spk ^"fvox/fuzz fuzz hev_logon^"")     set_hudmessage(200,255,0, 0.0, 0.34, 0, 6.0, 15.0)     show_hudmessage(id, "Hi %s!^nWelcome to %s^nMap: %s^nNextmap: %s^nPlayers: %d/%d",name,hostname,mapname,nextmap,get_playersnum(),g_maxplayers) }

Rirre 10-07-2007 10:31

Re: Client Connect
 
EDIT: thanks.


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

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