01/04/2018, 06:52 PM
Buenas tengo este problema con un mensaje HUD, me muestra un valor diferente al de el "client_print(print_center", les dejare fotos y el código para que me ayuden por favor!!! de antemano les digo que estoy aprendiendo pawn aun me considero principiante aunque ya se cosas básicas..
Código PHP:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "Hud Ready O Kick"
#define VERSION "1.0"
#define AUTHOR "Jeos"
new iMaxPlayers
new ready[33]
new iReadyTimer[33]
new ReadyTime
new iTimer
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
ReadyTime = register_cvar("tiempo_ready", "120") // 2 minutos
iMaxPlayers = get_maxplayers()
register_clcmd("say .ready", "ready_up")
// Add your code here...
}
public fwHamPlayerSpawnPost(id)
{
if(is_user_alive(id))
{
if( ready[id] || task_exists(id) || !is_user_alive(id))
return PLUGIN_HANDLED
new iReadyTime = iReadyTimer[id] = get_pcvar_num(ReadyTime) + 1
if(iReadyTime < 1)
{
iReadyTime = 1
set_pcvar_num(ReadyTime, iReadyTime)
}
new name[32]
get_user_name( id, name, charsmax(name))
set_task(1.0, "task_DisplayReadyMsg", id, name, charsmax(name), "a", iReadyTime)
}
return PLUGIN_HANDLED
}
public task_DisplayReadyMsg(name[], id)
{
static Seconds, Minutes
iTimer = --iReadyTimer[id]
Minutes = ( iTimer / 60 )
Seconds = ( iTimer % 60 )
new hud[256]
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue
}
get_user_name(i, name, 31)
format(hud, charsmax(hud), "%s%s - (%i:%02i)^n", hud, name, Minutes, Seconds ) // AQUI
// AQUI TENGO EL INCONVENIENTE NO MUESTRA EL TIEMPO DE CADA JUGADOR, MUESTRA EL DEL PRIMERO QUE ENTRA AL SV AL LADO DE CADA JUGADOR
}
for(new i = 1 ; i <= iMaxPlayers ; i++)
{
if(!is_user_connected(i) || !(1 <= get_user_team(i) <= 2))
{
continue
}
set_hudmessage(0, 255, 0, 0.84, 0.1, 0, 1.0, 1.1, 0.1, 0.2, 2)
show_hudmessage(i, hud)
}
client_print(id, print_center, "[AMXX] Escribe .ready o seras expulsado en (%i:%02i)", Minutes, Seconds)
if( !iTimer )
{
set_task(2.0, "task_KickPlayer", id)
}
}
public task_KickPlayer(id)
{
emessage_begin( MSG_ONE, SVC_DISCONNECT, _, id )
ewrite_string("Escribe .ready antes de los 2 minutos")
emessage_end()
static name[32]
get_user_name( id, name, 31 )
client_print(0, print_chat, "El jugador %s fue expulsado por no poner .ready", name)
server_print("El jugador %s fue expulsado por no poner .ready", name)
}
public client_putinserver(id)
{
if(ready[id])
{
remove_task(id)
ready[id] = false
}
}
public client_disconnect(id)
{
remove_task(id)
ready[id] = false
}
public ready_up(id)
{
remove_task(id)
ready[id] = true
}