←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Poprawa kodu

Zablokowany

  • +
  • -
.minD - zdjęcie .minD 03.07.2010

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "Automatyczyn Respawn"
#define VERSION "1.0"
#define AUTHOR ".minD"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task (7.0,"respawn", _, _, _, "a", "1")
}
public respawn(id)
{
new gracz[32]

read_argv(1, gracz, 31)

new player = cmd_target(1, gracz, 31)

spawn(player)
spawn(player)

return PLUGIN_HANDLED
}



może ktoś poprawić kod, żeby po 7 sekundach od wejścia na serwer odżywiło gracza?
Odpowiedz

  • +
  • -
Knopers - zdjęcie Knopers 03.07.2010


#include <amxmodx>
#include <fakemeta>
#include <cstrike>

public plugin_init()
register_plugin("Automatyczyn Respawn", "1.0", ".minD")
public client_putinserver(id)
{
if(!task_exists(id))
set_task(7.0, "respawn_player");
}
public client_disconnect(id)
{
if(task_exists(id))
remove_task(id);
}
public respawn_player(id)
{
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
return;

set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
dllfunc(DLLFunc_Think, id);

if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
dllfunc(DLLFunc_Spawn, id);
}
Odpowiedz

  • +
  • -
Owner123 - zdjęcie Owner123 03.07.2010

To co dał Knopers i jeszcze:
set_task(7.0, "respawn_player", id);

BTW. Według kodu od Knopersa będzie ożywiać tylko boty ;>
Użytkownik Owner123 edytował ten post 03.07.2010 20:58
Odpowiedz

  • +
  • -
Knopers - zdjęcie Knopers 04.07.2010

można jeszcze zrobić tak :P, mniej kodu:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
register_plugin("Automatyczyn Respawn", "1.0", ".minD")
public client_putinserver(id)
{
if(!task_exists(id))
set_task(7.0, "respawn_player", id);
}
public client_disconnect(id)
{
if(task_exists(id))
remove_task(id);
}
public respawn_player(id)
{
if (!is_user_connected(id) || is_user_alive(id) || get_user_team(id) == 4 || get_user_team(id) == 0)
return;

ExecuteHamB(Ham_CS_RoundRespawn, id);
}
Odpowiedz
Zablokowany