←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Przerobienie pluginu

Locked

  • +
  • -
Ziomek387's Photo Ziomek387 04.02.2010

Mam takie pytanie. Przerobiłem plugin tak aby w drużynie CT oraz TT pokazywalo co innego (ShowSyncHudMsg) ,lecz coś musiałem źle zrobić ,ponieważ w CT nie pokazuje się nic.

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "JailBreak: Basic Info"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define USERTASK 921
#define UPDATEDELAY 1.0

new static wiezienie[][] = { 
	"gwalt",
	"narkotyki",
	"zabojstwo",
	"alkohol",
	"molestowanie",
	"pobicie babci",
	"napad na monopolowy",
	"dziesione"
}

new userreason[33]
new rounds, hudhandler

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)	
	
	register_event("TextMsg","restart_roundsnum","a","2&#Game_C"/*,"2&#Game_w"*/) 
	
	register_logevent("round_end", 2, "1=Round_End")  
	
	RegisterHam(Ham_Spawn, "player", "client_spawn", 1)	
	
	hudhandler = CreateHudSyncObj()
}

public round_end()
{
	rounds ++
}

public restart_roundsnum() 
{
	rounds = 0 
}

public client_disconnect(id)
{
	userreason[id] = -1
	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}
}

public client_spawn(id)
{	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}	
	
	if(get_user_team(id) == 1)
	{	
		userreason[id] = random_num(0, sizeof reasons - 1)
		
		set_task(UPDATEDELAY, "client_jailinfo", id + USERTASK, _, _, "b")
	}	
	
	if(get_user_team(id) == 2)
	{	
		userreason[id] = random_num(0, sizeof reasons - 1)
		
		set_task(UPDATEDELAY, "client_klaiwsz", id + USERTASK, _, _, "b")
	}	

	}

public client_jailinfo(TASKID)
{
	static id
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, hudhandler, "-----------------------------^nDzien %d^nSiedzisz za %s^n-----------------------------", rounds, reasons[userreason[id]])	
}

public client_klawisz(TASKID)
{
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, hudhandler, "-----------------------------^nDzien %d^n-----------------------------", rounds)	
}

W czym może leżeć błąd ?
Quote

honey's Photo honey 04.02.2010

Spróbuj tak:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "JailBreak: Basic Info"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define USERTASK 921
#define UPDATEDELAY 1.0

new static wiezienie[][] = { 
	"gwalt",
	"narkotyki",
	"zabojstwo",
	"alkohol",
	"molestowanie",
	"pobicie babci",
	"napad na monopolowy",
	"dziesione"
}

new userreason[33]
new rounds, hudhandler

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)	
	
	register_event("TextMsg","restart_roundsnum","a","2&#Game_C"/*,"2&#Game_w"*/) 
	
	register_logevent("round_end", 2, "1=Round_End") 
	
	RegisterHam(Ham_Spawn, "player", "client_spawn", 1)	
	
	g_iHudSync1 = CreateHudSyncObj()
	g_iHudSync2 = CreateHudSyncObj()
	
}

public round_end()
{
	rounds ++
}

public restart_roundsnum() 
{
	rounds = 0 
}

public client_disconnect(id)
{
	userreason[id] = -1
	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}
}

public client_spawn(id)
{	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}	
	
	if(get_user_team(id) == 1)
	{	
		userreason[id] = random_num(0, sizeof reasons - 1)
		
		set_task(UPDATEDELAY, "client_jailinfo", id + USERTASK, _, _, "b")
	}	
	
	if(get_user_team(id) == 2)
	{	
		userreason[id] = random_num(0, sizeof reasons - 1)
		
		set_task(UPDATEDELAY, "client_klaiwsz", id + USERTASK, _, _, "b")
	}	

	}

public client_jailinfo(TASKID)
{
	static id
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, g_iHudSync1, "-----------------------------^nDzien %d^nSiedzisz za %s^n-----------------------------", rounds, reasons[userreason[id]])	
}

public client_klawisz(TASKID)
{
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, g_iHudSync2, "-----------------------------^nDzien %d^n-----------------------------", rounds)	
}


#Edit:
Aha i jeszcze nad:
	id = TASKID - USERTASK
w client_klawisz dodaj:
static id

Aby to wyglądało tak:
public client_klawisz(TASKID)
{
 static id
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, g_iHudSync2, "-----------------------------^nDzien %d^n-----------------------------", rounds)	
}

Edited by honey, 04.02.2010 10:09.
Quote

  • +
  • -
Owner123's Photo Owner123 04.02.2010

Wiesz o tym że to co dałeś nie ma prawa się skompilować ?
Było trochę błędów i poprawiłem :S
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "JailBreak: Basic Info"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define USERTASK 921
#define UPDATEDELAY 1.0

new const wiezienie[][] = { 
	"gwalt",
	"narkotyki",
	"zabojstwo",
	"alkohol",
	"molestowanie",
	"pobicie babci",
	"napad na monopolowy",
	"dziesione"
}

new userreason[33]
new rounds
new g_iHudSync1,
	g_iHudSync2

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)	
	
	register_event("TextMsg","restart_roundsnum","a","2&#Game_C"/*,"2&#Game_w"*/) 
	
	register_logevent("round_end", 2, "1=Round_End") 
	
	RegisterHam(Ham_Spawn, "player", "client_spawn", 1)	
	
	g_iHudSync1 = CreateHudSyncObj()
	g_iHudSync2 = CreateHudSyncObj()
	
}

public round_end()
{
	rounds ++
}

public restart_roundsnum() 
{
	rounds = 0 
}

public client_disconnect(id)
{
	userreason[id] = -1
	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}
}

public client_spawn(id)
{	
	if(task_exists(id + USERTASK))
	{
		remove_task(id + USERTASK)
	}	
	
	if(get_user_team(id) == 1)
	{	
		userreason[id] = random_num(0, sizeof wiezienie - 1)
		
		set_task(UPDATEDELAY, "client_jailinfo", id + USERTASK, _, _, "b")
	}	
	
	if(get_user_team(id) == 2)
	{	
		userreason[id] = random_num(0, sizeof wiezienie - 1)
		
		set_task(UPDATEDELAY, "client_klaiwsz", id + USERTASK, _, _, "b")
	}	

	}

public client_jailinfo(TASKID)
{
	static id
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, g_iHudSync1, "-----------------------------^nDzien %d^nSiedzisz za %s^n-----------------------------", rounds, wiezienie[userreason[id]])	
}

public client_klawisz(TASKID)
{
	static id
	id = TASKID - USERTASK
	
	set_hudmessage(0, 30, 90, 0.8, 0.1, 0, 6.0, 12.0)
	
	ShowSyncHudMsg(id, g_iHudSync2, "-----------------------------^nDzien %d^n-----------------------------", rounds)	
}



Edited by Owner123, 04.02.2010 10:40.
Quote

honey's Photo honey 04.02.2010

Aff, zapomniałem dodać:
new g_iHudSync1, g_iHudSync2
Quote

  • +
  • -
G[o]Q's Photo G[o]Q 04.02.2010

raczej chodzi o to ze w tasku masz wywolanie "client_klaiwsz" a funkcja nazywa sie client_klawisz :D
Quote

  • +
  • -
Owner123's Photo Owner123 04.02.2010

Ups, no G[o]Q tu masz racje ;D
Ale tak czy owak w pluginie i tak były błędy ;)
Quote

  • +
  • -
G[o]Q's Photo G[o]Q 04.02.2010

w tym co on podal moze i byly ale warningi bo sie kompilowalo wystarczy taska zmienic w tym co gosc podal i bedzie hulać
Quote

  • +
  • -
Owner123's Photo Owner123 05.02.2010

Nie były warningi bo nie mogłem u siebie skompilować ._.
Quote
Locked