View Single Post
Author Message
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 11-14-2011 , 06:40   [CZ][INC&NATIVE] Czero Tutor
Reply With Quote #1

[Description]
This include able you to make advices with czero tutor!
Works ONLY in CS: Condition-Zero

OBS: I know that have another czero tutor inc, but that have so many erros.

- Put the file czerotutor.amxx in: amxmodx/plugins/
- Open the file amxmodx/configs/plugins.ini and write czerotutor.amxx


[Functions]
Code:
enum
{
	NONE = 0,
	RED,
	BLUE,
	YELLOW,
	GREEN
}

/**
 * Create a tutor
 *
 * @param id		Player index.
 * @param color		Color of the text.
 * @param sound		Sound to play when display tutor.
 * @param time		Time to the tutor still alive.
 * @param input		Text to display in tutor.
 * @return			1 on success, 0 otherwise.
 */
native create_user_cztutor(id, color = GREEN, sound[] = "", Float:time = 0.0, const input[] = "");


/**
 * Remove player tutor.
 *
 * @param id		Player index.
 * @return			1 on success, 0 otherwise.
 */
native remove_user_cztutor(id);


/**
 * Check if a tutor is displaying to this player.
 *
 * @param id		Player index.
 * @return			Color of player tutor (If not exists will return NONE).
 */
native is_user_cztutor(id);
[Example]
Code:
#include <amxmodx>
#include <czerotutor>

// Native only support .wav sounds
new szSound[] = { "sound/misc/tutor.wav" }

public plugin_precache()
{
	// Renember you have to precache the sound
	precache_sound(szSound)
}

public plugin_init() 
{
	register_plugin("New Plugin", "1.0", "Dark Style")
	
	register_event("HLTV", "roundstart", "a", "1=0", "2=0")
}

public client_authorized(id)
{
	// Index, Text, Color, Sound, Time.
	create_user_cztutor(id, RED, szSound, 5.0, "Welcome!")
}

public roundstart()
{
	// You don't need to get_players when don't have id, the native do it for you.
	if(is_user_cztutor(0) != NONE)
		remove_user_cztutor(0), create_user_cztutor(0, RED, szSound, 5.0, "Dungerous Server^nIP: XXX.XXX.XXX:XXXXX!")
	else
		create_user_cztutor(0, RED, szSound, 5.0, "Dungerous Server^nIP: XXX.XXX.XXX:XXXXX!")
}
Attached Files
File Type: sma Get Plugin or Get Source (czerotutor.sma - 2012 views - 2.4 KB)
File Type: inc czerotutor.inc (974 Bytes, 932 views)

Last edited by Dark Style; 11-14-2011 at 08:22.
Dark Style is offline