Solved rounds left

Unpaid Requests, Public Plugins
Post Reply
User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

rounds left

#1

Post by sPe3doN » 5 years ago

ola
i add roundsleft plugin to my server and i set in server.cfg mp_maxrounds 6 (6 rounds to change map) but evry round when i type roundsleft it's show me Remaining rounds: 6 can any one help ?

Code: Select all

new const PLUGINNAME[] = "Roundsleft"
new const VERSION[] = "2.4"
new const AUTHOR[] = "MisterJ"
/*

THANKS
========
Johnny got his gun : He created the concept and made the first version.


ROUNDSLEFT
==========
Allows the users to "say roundsleft" and remaining rounds will be displayed.
This is useful if you are using default hlds cvar mp_maxrounds set to some value.
There is also a command "amx_roundsleft" to view remaining rounds in console.


HOW TO INSTALL
==============
1. Name this file roundsleft.sma.
2. Compile it into roundsleft.amxx.
3. Put roundsleft.amxx into amxmodx/plugins directory.
4. Open up amxmodx/configs/plugins.ini and add a line to the end saying: roundsleft.amx
5. Done. Type reload in your server.


HOW TO USE
==========
say roundsleft, say rounds, say roundleft, say round
- all these will respond with remaining rounds if mp_maxrounds is set to anything higher than 0.

amx_roundsleft
- displays remaining rounds in console. Works also from server console.


VERSION
========
2.4

*/

#include <amxmodx>
#include <amxmisc>
#include <engine>

// Globals below
new g_teamScore[2]
// Globals above

public sayRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id) {
		if (maxRounds == 0) {
			client_print(0, print_chat, "No rounds limit.")
		}
		else {
			new roundsleft = maxRounds - (g_teamScore[0] + g_teamScore[1])
			client_print(0, print_chat, "Remaining rounds: %d", roundsleft)
			speakroundsleft(id, roundsleft)
		}
	}

	return PLUGIN_CONTINUE
}

speakroundsleft(id, roundsleft) {
	new numbers[256]
	getnumbers(roundsleft, numbers, 255)
	client_cmd(id, "spk ^"%s round remaining^"", numbers)
	//client_print(0, print_chat, "%s round%s remain", numbers, roundsleft > 1 ? "s" : "")
}

public conRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id)	console_print(id,"Remaining rounds: %d",maxRounds - (g_teamScore[0] + g_teamScore[1]))
	else server_print("Remaining rounds: %d",maxRounds - (g_teamScore[0] + g_teamScore[1]))

	return PLUGIN_HANDLED
}

public teamScore(id) {
	new team[2]
	read_data(1,team,1)
	g_teamScore[(team[0]=='C')? 0 : 1] = read_data(2)

	return PLUGIN_CONTINUE
}

/*
public newround_event(id) {
	if (is_user_bot(id))
		return PLUGIN_CONTINUE

	new maxRounds = get_cvar_num("mp_maxrounds")
	if (maxRounds) {
		set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
		show_hudmessage(id, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
		client_print(id, print_chat, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
	}

	return PLUGIN_CONTINUE
}
*/

public endround_event() {
	server_print("endround_event, %d entities in game", entity_count())
	set_task(2.0, "endofroundspk")

	return PLUGIN_CONTINUE
}

public endofroundspk() {
	//server_print("endofroundspk")
	new maxRounds = get_cvar_num("mp_maxrounds")
	new roundsleft = maxRounds - (g_teamScore[0] + g_teamScore[1])
	new nextmap[64]
	get_cvar_string("amx_nextmap", nextmap, 63)
	if (maxRounds) {
		set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)

		if (roundsleft == 100)
		show_hudmessage(0, "100 rounds remaining", roundsleft)

		if (roundsleft == 80)
		show_hudmessage(0, "80 rounds remaining", roundsleft)

		if (roundsleft == 60)
		show_hudmessage(0, "60 rounds remaining", roundsleft)		

		if (roundsleft == 50)
		show_hudmessage(0, "50 rounds remaining", roundsleft)

		if (roundsleft == 40)
		show_hudmessage(0, "40 rounds remaining", roundsleft)	

		if (roundsleft == 30)
		show_hudmessage(0, "30 rounds remaining", roundsleft)		

		if (roundsleft == 20)
		show_hudmessage(0, "20 rounds remaining", roundsleft)

		if (roundsleft == 10)
		show_hudmessage(0, "10 rounds remaining", roundsleft)

		if (roundsleft == 5)
		show_hudmessage(0, "5 rounds remaining", roundsleft)
		
		if (roundsleft == 1)
		show_hudmessage(0, "The last round", roundsleft)

		if (roundsleft == 0)
		show_hudmessage(0, "Nextmap is %s...", nextmap)
			
		}


	if (roundsleft > 0) {

		if (roundsleft == 90)
		client_cmd(0, "spk ^"ninety round remaining^"")

		if (roundsleft == 80)
		client_cmd(0, "spk ^"eighty round remaining^"")

		if (roundsleft == 70)
		client_cmd(0, "spk ^"seventy round remaining^"")

		if (roundsleft == 60)
		client_cmd(0, "spk ^"sixty round remaining^"")		

		if (roundsleft == 50)
		client_cmd(0, "spk ^"fifty round remaining^"")
	
		if (roundsleft == 40)
		client_cmd(0, "spk ^"fourty round remaining^"")

		if (roundsleft == 30)
		client_cmd(0, "spk ^"thirty round remaining^"")

		if (roundsleft == 20)
		client_cmd(0, "spk ^"twenty round remaining^"")

		if (roundsleft == 10)
		client_cmd(0, "spk ^"ten round remaining^"")

		if (roundsleft == 5)
		client_cmd(0, "spk ^"five round remaining^"")

		if (roundsleft == 1)
		client_cmd(0, "spk ^"the last round^"")

		}
	

	}



stock getnumbers(number, wordnumbers[], length) {
	if (number < 0) {
		format(wordnumbers, length, "error")
		return
	}

	new numberstr[20]
	num_to_str(number, numberstr, 19)
	new stlen = strlen(numberstr), bool:getzero = false, bool:jumpnext = false
	if (stlen == 1)
		getzero = true

	do {
		if (jumpnext)
			jumpnext = false
		else if (numberstr[0] != '0') {
			switch (stlen) {
				case 9: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " million" : "")
				}
				case 8: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (jumpnext)
						format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 7: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 6: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " thousand" : "")
				}
				case 5: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (numberstr[0] == '1' || numberstr[1] == '0')
						format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 4: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 3: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s hundred", wordnumbers)
				}
				case 2: jumpnext = gettens(wordnumbers, length, numberstr)
				case 1: {
					getsingledigit(numberstr[0], wordnumbers, length, getzero)
					break // could've trimmed, but of no use here
				}
				default: {
					format(wordnumbers, length, "%s TOO LONG", wordnumbers)
					break
				}
			}
		}

		jghg_trim(numberstr, length, 1)
		stlen = strlen(numberstr)
	}
	while (stlen > 0)

	// Trim a char from left if first char is a space (very likely)
	if (wordnumbers[0] == ' ')
		jghg_trim(wordnumbers, length, 1)
}

// Returns true if next char should be jumped
stock bool:gettens(wordnumbers[], length, numberstr[]) {
	new digitstr[11], bool:dont = false, bool:jumpnext = false
	switch (numberstr[0]) {
		case '1': {
			jumpnext = true
			switch (numberstr[1]) {
				case '0': digitstr = "ten"
				case '1': digitstr = "eleven"
				case '2': digitstr = "twelve"
				case '3': digitstr = "thirteen"
				case '4': digitstr = "fourteen"
				case '5': digitstr = "fifteen"
				case '6': digitstr = "sixteen"
				case '7': digitstr = "seventeen"
				case '8': digitstr = "eighteen"
				case '9': digitstr = "nineteen"
				default: digitstr = "TEENSERROR"
			}
		}
		case '2': digitstr = "twenty"
		case '3': digitstr = "thirty"
		case '4': digitstr = "fourty"
		case '5': digitstr = "fifty"
		case '6': digitstr = "sixty"
		case '7': digitstr = "seventy"
		case '8': digitstr = "eighty"
		case '9': digitstr = "ninety"
		case '0': dont = true // do nothing
		default : digitstr = "TENSERROR"
	}
	if (!dont)
		format(wordnumbers, length, "%s %s", wordnumbers, digitstr)

	return jumpnext
}

// Returns true when sets, else false
stock getsingledigit(digit[], numbers[], length, bool:getzero = false) {
	new digitstr[11]
	switch (digit[0]) {
		case '1': digitstr = "one"
		case '2': digitstr = "two"
		case '3': digitstr = "three"
		case '4': digitstr = "four"
		case '5': digitstr = "five"
		case '6': digitstr = "six"
		case '7': digitstr = "seven"
		case '8': digitstr = "eight"
		case '9': digitstr = "nine"
		case '0': {
			if (getzero)
				digitstr = "zero"
			else
				return false
		}
		default : digitstr = "digiterror"
	}
	format(numbers, length, "%s %s", numbers, digitstr)

	return true
}

stock jghg_trim(stringtotrim[], len, charstotrim, bool:fromleft = true) {
	if (charstotrim <= 0)
		return

	if (fromleft) {
		new maxlen = strlen(stringtotrim)
		if (charstotrim > maxlen)
			charstotrim = maxlen

		format(stringtotrim, len, "%s", stringtotrim[charstotrim])
	}
	else {
		new maxlen = strlen(stringtotrim) - charstotrim
		if (maxlen < 0)
			maxlen = 0

		format(stringtotrim, maxlen, "%s", stringtotrim)
	}
}

public addrounds(id, level, cid) {
	if (!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)
	new arglength = strlen(arg)
	for (new i = 0; i < arglength; i++) {
		if (!isdigit(arg[i])) {
			if (i != 0 || arg[0] != '-') {
				console_print(id, "Error: Enter only numbers, ie ^"amx_addrounds 10^"")
				return PLUGIN_HANDLED
			}
		}
	}

	new roundstoadd = str_to_num(arg)

	if (roundstoadd == 0) {
		console_print(id, "Error: Well duuuh. Enter a positive or negative value, ie ^"amx_addrounds 10^"")
		return PLUGIN_HANDLED
	}

	new originalmaxrounds = get_cvar_num("mp_maxrounds")

	new newmaxrounds = originalmaxrounds + roundstoadd

	if (newmaxrounds < 1)
		newmaxrounds = 1

	new roundschanged = newmaxrounds - originalmaxrounds

	new Float:displayrounds = float(roundschanged)
	displayrounds *= displayrounds
	displayrounds = floatsqroot(displayrounds)

	console_print(id, "%sing %d rounds...", roundschanged > 0 ? "Add" : "Remov", floatround(displayrounds))

	set_cvar_num("mp_maxrounds", newmaxrounds)

	conRoundsLeft(id)

	return PLUGIN_HANDLED
}

public plugin_init() {
	register_plugin(PLUGINNAME, VERSION, AUTHOR)
	register_clcmd("say round", "sayRoundsLeft")
	register_clcmd("say rounds", "sayRoundsLeft")
 	register_clcmd("say roundleft", "sayRoundsLeft")
 	register_clcmd("say roundsleft", "sayRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_roundsleft", "conRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_addrounds", "addrounds", ADMIN_CFG, "<rounds> - add/remove remaining rounds")
	register_event("TeamScore", "teamScore", "ab")
	//register_event("ResetHUD", "newround_event", "b")
	/*
	register_event("SendAudio","endround_event","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
	register_event("TextMsg","endround_event","a","2&#Game_C","2&#Game_w")
	register_event("TextMsg","endround_event","a","2&#Game_will_restart_in")
	*/
	/*
	register_logevent("death_event",5,"1=killed","3=with")
	// L 03/08/2004 - 13:32:34: "xian<2><BOT><CT>" killed "SuperKaka<1><BOT><TERRORIST>" with "usp"
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	*/
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	/*register_logevent("endround_event", 3, "2=Round_End")
	register_logevent("endround_event", 3, "1=Round_End")
	register_logevent("endround_event", 3, "0=Round_End")
	register_logevent("endround_event", 3, "3=Round_End")*/
	register_logevent("endround_event", 2, "0=World triggered", "1=Round_End")
}
Image

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#2

Post by sPe3doN » 5 years ago

Any one ?
Image

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#3

Post by sPe3doN » 5 years ago

Come on ppl any one ?
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#4

Post by Muhammet20 » 5 years ago

sPe3doN wrote: 5 years ago ola
i add roundsleft plugin to my server and i set in server.cfg mp_maxrounds 6 (6 rounds to change map) but evry round when i type roundsleft it's show me Remaining rounds: 6 can any one help ?

Code: Select all

new const PLUGINNAME[] = "Roundsleft"
new const VERSION[] = "2.4"
new const AUTHOR[] = "MisterJ"
/*

THANKS
========
Johnny got his gun : He created the concept and made the first version.


ROUNDSLEFT
==========
Allows the users to "say roundsleft" and remaining rounds will be displayed.
This is useful if you are using default hlds cvar mp_maxrounds set to some value.
There is also a command "amx_roundsleft" to view remaining rounds in console.


HOW TO INSTALL
==============
1. Name this file roundsleft.sma.
2. Compile it into roundsleft.amxx.
3. Put roundsleft.amxx into amxmodx/plugins directory.
4. Open up amxmodx/configs/plugins.ini and add a line to the end saying: roundsleft.amx
5. Done. Type reload in your server.


HOW TO USE
==========
say roundsleft, say rounds, say roundleft, say round
- all these will respond with remaining rounds if mp_maxrounds is set to anything higher than 0.

amx_roundsleft
- displays remaining rounds in console. Works also from server console.


VERSION
========
2.4

*/

#include <amxmodx>
#include <amxmisc>
#include <engine>

// Globals below
new g_teamScore[2]
// Globals above

public sayRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id) {
		if (maxRounds == 0) {
			client_print(0, print_chat, "No rounds limit.")
		}
		else {
			new roundsleft = maxRounds - (g_teamScore[0] + g_teamScore[1])
			client_print(0, print_chat, "Remaining rounds: %d", roundsleft)
			speakroundsleft(id, roundsleft)
		}
	}

	return PLUGIN_CONTINUE
}

speakroundsleft(id, roundsleft) {
	new numbers[256]
	getnumbers(roundsleft, numbers, 255)
	client_cmd(id, "spk ^"%s round remaining^"", numbers)
	//client_print(0, print_chat, "%s round%s remain", numbers, roundsleft > 1 ? "s" : "")
}

public conRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id)	console_print(id,"Remaining rounds: %d",maxRounds - (g_teamScore[0] + g_teamScore[1]))
	else server_print("Remaining rounds: %d",maxRounds - (g_teamScore[0] + g_teamScore[1]))

	return PLUGIN_HANDLED
}

public teamScore(id) {
	new team[2]
	read_data(1,team,1)
	g_teamScore[(team[0]=='C')? 0 : 1] = read_data(2)

	return PLUGIN_CONTINUE
}

/*
public newround_event(id) {
	if (is_user_bot(id))
		return PLUGIN_CONTINUE

	new maxRounds = get_cvar_num("mp_maxrounds")
	if (maxRounds) {
		set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
		show_hudmessage(id, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
		client_print(id, print_chat, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
	}

	return PLUGIN_CONTINUE
}
*/

public endround_event() {
	server_print("endround_event, %d entities in game", entity_count())
	set_task(2.0, "endofroundspk")

	return PLUGIN_CONTINUE
}

public endofroundspk() {
	//server_print("endofroundspk")
	new maxRounds = get_cvar_num("mp_maxrounds")
	new roundsleft = maxRounds - (g_teamScore[0] + g_teamScore[1])
	new nextmap[64]
	get_cvar_string("amx_nextmap", nextmap, 63)
	if (maxRounds) {
		set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)

		if (roundsleft == 100)
		show_hudmessage(0, "100 rounds remaining", roundsleft)

		if (roundsleft == 80)
		show_hudmessage(0, "80 rounds remaining", roundsleft)

		if (roundsleft == 60)
		show_hudmessage(0, "60 rounds remaining", roundsleft)		

		if (roundsleft == 50)
		show_hudmessage(0, "50 rounds remaining", roundsleft)

		if (roundsleft == 40)
		show_hudmessage(0, "40 rounds remaining", roundsleft)	

		if (roundsleft == 30)
		show_hudmessage(0, "30 rounds remaining", roundsleft)		

		if (roundsleft == 20)
		show_hudmessage(0, "20 rounds remaining", roundsleft)

		if (roundsleft == 10)
		show_hudmessage(0, "10 rounds remaining", roundsleft)

		if (roundsleft == 5)
		show_hudmessage(0, "5 rounds remaining", roundsleft)
		
		if (roundsleft == 1)
		show_hudmessage(0, "The last round", roundsleft)

		if (roundsleft == 0)
		show_hudmessage(0, "Nextmap is %s...", nextmap)
			
		}


	if (roundsleft > 0) {

		if (roundsleft == 90)
		client_cmd(0, "spk ^"ninety round remaining^"")

		if (roundsleft == 80)
		client_cmd(0, "spk ^"eighty round remaining^"")

		if (roundsleft == 70)
		client_cmd(0, "spk ^"seventy round remaining^"")

		if (roundsleft == 60)
		client_cmd(0, "spk ^"sixty round remaining^"")		

		if (roundsleft == 50)
		client_cmd(0, "spk ^"fifty round remaining^"")
	
		if (roundsleft == 40)
		client_cmd(0, "spk ^"fourty round remaining^"")

		if (roundsleft == 30)
		client_cmd(0, "spk ^"thirty round remaining^"")

		if (roundsleft == 20)
		client_cmd(0, "spk ^"twenty round remaining^"")

		if (roundsleft == 10)
		client_cmd(0, "spk ^"ten round remaining^"")

		if (roundsleft == 5)
		client_cmd(0, "spk ^"five round remaining^"")

		if (roundsleft == 1)
		client_cmd(0, "spk ^"the last round^"")

		}
	

	}



stock getnumbers(number, wordnumbers[], length) {
	if (number < 0) {
		format(wordnumbers, length, "error")
		return
	}

	new numberstr[20]
	num_to_str(number, numberstr, 19)
	new stlen = strlen(numberstr), bool:getzero = false, bool:jumpnext = false
	if (stlen == 1)
		getzero = true

	do {
		if (jumpnext)
			jumpnext = false
		else if (numberstr[0] != '0') {
			switch (stlen) {
				case 9: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " million" : "")
				}
				case 8: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (jumpnext)
						format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 7: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 6: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " thousand" : "")
				}
				case 5: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (numberstr[0] == '1' || numberstr[1] == '0')
						format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 4: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 3: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s hundred", wordnumbers)
				}
				case 2: jumpnext = gettens(wordnumbers, length, numberstr)
				case 1: {
					getsingledigit(numberstr[0], wordnumbers, length, getzero)
					break // could've trimmed, but of no use here
				}
				default: {
					format(wordnumbers, length, "%s TOO LONG", wordnumbers)
					break
				}
			}
		}

		jghg_trim(numberstr, length, 1)
		stlen = strlen(numberstr)
	}
	while (stlen > 0)

	// Trim a char from left if first char is a space (very likely)
	if (wordnumbers[0] == ' ')
		jghg_trim(wordnumbers, length, 1)
}

// Returns true if next char should be jumped
stock bool:gettens(wordnumbers[], length, numberstr[]) {
	new digitstr[11], bool:dont = false, bool:jumpnext = false
	switch (numberstr[0]) {
		case '1': {
			jumpnext = true
			switch (numberstr[1]) {
				case '0': digitstr = "ten"
				case '1': digitstr = "eleven"
				case '2': digitstr = "twelve"
				case '3': digitstr = "thirteen"
				case '4': digitstr = "fourteen"
				case '5': digitstr = "fifteen"
				case '6': digitstr = "sixteen"
				case '7': digitstr = "seventeen"
				case '8': digitstr = "eighteen"
				case '9': digitstr = "nineteen"
				default: digitstr = "TEENSERROR"
			}
		}
		case '2': digitstr = "twenty"
		case '3': digitstr = "thirty"
		case '4': digitstr = "fourty"
		case '5': digitstr = "fifty"
		case '6': digitstr = "sixty"
		case '7': digitstr = "seventy"
		case '8': digitstr = "eighty"
		case '9': digitstr = "ninety"
		case '0': dont = true // do nothing
		default : digitstr = "TENSERROR"
	}
	if (!dont)
		format(wordnumbers, length, "%s %s", wordnumbers, digitstr)

	return jumpnext
}

// Returns true when sets, else false
stock getsingledigit(digit[], numbers[], length, bool:getzero = false) {
	new digitstr[11]
	switch (digit[0]) {
		case '1': digitstr = "one"
		case '2': digitstr = "two"
		case '3': digitstr = "three"
		case '4': digitstr = "four"
		case '5': digitstr = "five"
		case '6': digitstr = "six"
		case '7': digitstr = "seven"
		case '8': digitstr = "eight"
		case '9': digitstr = "nine"
		case '0': {
			if (getzero)
				digitstr = "zero"
			else
				return false
		}
		default : digitstr = "digiterror"
	}
	format(numbers, length, "%s %s", numbers, digitstr)

	return true
}

stock jghg_trim(stringtotrim[], len, charstotrim, bool:fromleft = true) {
	if (charstotrim <= 0)
		return

	if (fromleft) {
		new maxlen = strlen(stringtotrim)
		if (charstotrim > maxlen)
			charstotrim = maxlen

		format(stringtotrim, len, "%s", stringtotrim[charstotrim])
	}
	else {
		new maxlen = strlen(stringtotrim) - charstotrim
		if (maxlen < 0)
			maxlen = 0

		format(stringtotrim, maxlen, "%s", stringtotrim)
	}
}

public addrounds(id, level, cid) {
	if (!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)
	new arglength = strlen(arg)
	for (new i = 0; i < arglength; i++) {
		if (!isdigit(arg[i])) {
			if (i != 0 || arg[0] != '-') {
				console_print(id, "Error: Enter only numbers, ie ^"amx_addrounds 10^"")
				return PLUGIN_HANDLED
			}
		}
	}

	new roundstoadd = str_to_num(arg)

	if (roundstoadd == 0) {
		console_print(id, "Error: Well duuuh. Enter a positive or negative value, ie ^"amx_addrounds 10^"")
		return PLUGIN_HANDLED
	}

	new originalmaxrounds = get_cvar_num("mp_maxrounds")

	new newmaxrounds = originalmaxrounds + roundstoadd

	if (newmaxrounds < 1)
		newmaxrounds = 1

	new roundschanged = newmaxrounds - originalmaxrounds

	new Float:displayrounds = float(roundschanged)
	displayrounds *= displayrounds
	displayrounds = floatsqroot(displayrounds)

	console_print(id, "%sing %d rounds...", roundschanged > 0 ? "Add" : "Remov", floatround(displayrounds))

	set_cvar_num("mp_maxrounds", newmaxrounds)

	conRoundsLeft(id)

	return PLUGIN_HANDLED
}

public plugin_init() {
	register_plugin(PLUGINNAME, VERSION, AUTHOR)
	register_clcmd("say round", "sayRoundsLeft")
	register_clcmd("say rounds", "sayRoundsLeft")
 	register_clcmd("say roundleft", "sayRoundsLeft")
 	register_clcmd("say roundsleft", "sayRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_roundsleft", "conRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_addrounds", "addrounds", ADMIN_CFG, "<rounds> - add/remove remaining rounds")
	register_event("TeamScore", "teamScore", "ab")
	//register_event("ResetHUD", "newround_event", "b")
	/*
	register_event("SendAudio","endround_event","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
	register_event("TextMsg","endround_event","a","2&#Game_C","2&#Game_w")
	register_event("TextMsg","endround_event","a","2&#Game_will_restart_in")
	*/
	/*
	register_logevent("death_event",5,"1=killed","3=with")
	// L 03/08/2004 - 13:32:34: "xian<2><BOT><CT>" killed "SuperKaka<1><BOT><TERRORIST>" with "usp"
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	*/
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	/*register_logevent("endround_event", 3, "2=Round_End")
	register_logevent("endround_event", 3, "1=Round_End")
	register_logevent("endround_event", 3, "0=Round_End")
	register_logevent("endround_event", 3, "3=Round_End")*/
	register_logevent("endround_event", 2, "0=World triggered", "1=Round_End")
}
i have same problem

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#5

Post by Night Fury » 5 years ago

Try:

Code: Select all

new const PLUGINNAME[] = "Roundsleft"
new const VERSION[] = "2.4"
new const AUTHOR[] = "MisterJ"
/*

THANKS
========
Johnny got his gun : He created the concept and made the first version.


ROUNDSLEFT
==========
Allows the users to "say roundsleft" and remaining rounds will be displayed.
This is useful if you are using default hlds cvar mp_maxrounds set to some value.
There is also a command "amx_roundsleft" to view remaining rounds in console.


HOW TO INSTALL
==============
1. Name this file roundsleft.sma.
2. Compile it into roundsleft.amxx.
3. Put roundsleft.amxx into amxmodx/plugins directory.
4. Open up amxmodx/configs/plugins.ini and add a line to the end saying: roundsleft.amx
5. Done. Type reload in your server.


HOW TO USE
==========
say roundsleft, say rounds, say roundleft, say round
- all these will respond with remaining rounds if mp_maxrounds is set to anything higher than 0.

amx_roundsleft
- displays remaining rounds in console. Works also from server console.


VERSION
========
2.4

*/

#include <zombie_escape>
#include <engine>

// Globals above

public sayRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id) {
		if (maxRounds == 0) {
			client_print(0, print_chat, "No rounds limit.")
		}
		else {
			new roundsleft = maxRounds - (ze_get_round_number())
			client_print(0, print_chat, "Remaining rounds: %d", roundsleft)
			speakroundsleft(id, roundsleft)
		}
	}

	return PLUGIN_CONTINUE
}

speakroundsleft(id, roundsleft) {
	new numbers[256]
	getnumbers(roundsleft, numbers, 255)
	client_cmd(id, "spk ^"%s round remaining^"", numbers)
	//client_print(0, print_chat, "%s round%s remain", numbers, roundsleft > 1 ? "s" : "")
}

public conRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id)	console_print(id,"Remaining rounds: %d",maxRounds - (ze_get_round_number()))
	else server_print("Remaining rounds: %d",maxRounds - (ze_get_round_number()))

	return PLUGIN_HANDLED
}

/*
public newround_event(id) {
	if (is_user_bot(id))
		return PLUGIN_CONTINUE

	new maxRounds = get_cvar_num("mp_maxrounds")
	if (maxRounds) {
		set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
		show_hudmessage(id, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
		client_print(id, print_chat, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
	}

	return PLUGIN_CONTINUE
}
*/

public endround_event() {
	server_print("endround_event, %d entities in game", entity_count())
	set_task(2.0, "endofroundspk")

	return PLUGIN_CONTINUE
}

public endofroundspk() {
	//server_print("endofroundspk")
	new maxRounds = get_cvar_num("mp_maxrounds")
	new roundsleft = maxRounds - (ze_get_round_number())
	new nextmap[64]
	get_cvar_string("amx_nextmap", nextmap, 63)
	if (maxRounds) {
		set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)

		if (roundsleft == 100)
		show_hudmessage(0, "100 rounds remaining", roundsleft)

		if (roundsleft == 80)
		show_hudmessage(0, "80 rounds remaining", roundsleft)

		if (roundsleft == 60)
		show_hudmessage(0, "60 rounds remaining", roundsleft)		

		if (roundsleft == 50)
		show_hudmessage(0, "50 rounds remaining", roundsleft)

		if (roundsleft == 40)
		show_hudmessage(0, "40 rounds remaining", roundsleft)	

		if (roundsleft == 30)
		show_hudmessage(0, "30 rounds remaining", roundsleft)		

		if (roundsleft == 20)
		show_hudmessage(0, "20 rounds remaining", roundsleft)

		if (roundsleft == 10)
		show_hudmessage(0, "10 rounds remaining", roundsleft)

		if (roundsleft == 5)
		show_hudmessage(0, "5 rounds remaining", roundsleft)
		
		if (roundsleft == 1)
		show_hudmessage(0, "The last round", roundsleft)

		if (roundsleft == 0)
		show_hudmessage(0, "Nextmap is %s...", nextmap)
			
		}


	if (roundsleft > 0) {

		if (roundsleft == 90)
		client_cmd(0, "spk ^"ninety round remaining^"")

		if (roundsleft == 80)
		client_cmd(0, "spk ^"eighty round remaining^"")

		if (roundsleft == 70)
		client_cmd(0, "spk ^"seventy round remaining^"")

		if (roundsleft == 60)
		client_cmd(0, "spk ^"sixty round remaining^"")		

		if (roundsleft == 50)
		client_cmd(0, "spk ^"fifty round remaining^"")
	
		if (roundsleft == 40)
		client_cmd(0, "spk ^"fourty round remaining^"")

		if (roundsleft == 30)
		client_cmd(0, "spk ^"thirty round remaining^"")

		if (roundsleft == 20)
		client_cmd(0, "spk ^"twenty round remaining^"")

		if (roundsleft == 10)
		client_cmd(0, "spk ^"ten round remaining^"")

		if (roundsleft == 5)
		client_cmd(0, "spk ^"five round remaining^"")

		if (roundsleft == 1)
		client_cmd(0, "spk ^"the last round^"")

		}
	

	}



stock getnumbers(number, wordnumbers[], length) {
	if (number < 0) {
		format(wordnumbers, length, "error")
		return
	}

	new numberstr[20]
	num_to_str(number, numberstr, 19)
	new stlen = strlen(numberstr), bool:getzero = false, bool:jumpnext = false
	if (stlen == 1)
		getzero = true

	do {
		if (jumpnext)
			jumpnext = false
		else if (numberstr[0] != '0') {
			switch (stlen) {
				case 9: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " million" : "")
				}
				case 8: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (jumpnext)
						format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 7: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 6: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " thousand" : "")
				}
				case 5: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (numberstr[0] == '1' || numberstr[1] == '0')
						format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 4: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 3: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s hundred", wordnumbers)
				}
				case 2: jumpnext = gettens(wordnumbers, length, numberstr)
				case 1: {
					getsingledigit(numberstr[0], wordnumbers, length, getzero)
					break // could've trimmed, but of no use here
				}
				default: {
					format(wordnumbers, length, "%s TOO LONG", wordnumbers)
					break
				}
			}
		}

		jghg_trim(numberstr, length, 1)
		stlen = strlen(numberstr)
	}
	while (stlen > 0)

	// Trim a char from left if first char is a space (very likely)
	if (wordnumbers[0] == ' ')
		jghg_trim(wordnumbers, length, 1)
}

// Returns true if next char should be jumped
stock bool:gettens(wordnumbers[], length, numberstr[]) {
	new digitstr[11], bool:dont = false, bool:jumpnext = false
	switch (numberstr[0]) {
		case '1': {
			jumpnext = true
			switch (numberstr[1]) {
				case '0': digitstr = "ten"
				case '1': digitstr = "eleven"
				case '2': digitstr = "twelve"
				case '3': digitstr = "thirteen"
				case '4': digitstr = "fourteen"
				case '5': digitstr = "fifteen"
				case '6': digitstr = "sixteen"
				case '7': digitstr = "seventeen"
				case '8': digitstr = "eighteen"
				case '9': digitstr = "nineteen"
				default: digitstr = "TEENSERROR"
			}
		}
		case '2': digitstr = "twenty"
		case '3': digitstr = "thirty"
		case '4': digitstr = "fourty"
		case '5': digitstr = "fifty"
		case '6': digitstr = "sixty"
		case '7': digitstr = "seventy"
		case '8': digitstr = "eighty"
		case '9': digitstr = "ninety"
		case '0': dont = true // do nothing
		default : digitstr = "TENSERROR"
	}
	if (!dont)
		format(wordnumbers, length, "%s %s", wordnumbers, digitstr)

	return jumpnext
}

// Returns true when sets, else false
stock getsingledigit(digit[], numbers[], length, bool:getzero = false) {
	new digitstr[11]
	switch (digit[0]) {
		case '1': digitstr = "one"
		case '2': digitstr = "two"
		case '3': digitstr = "three"
		case '4': digitstr = "four"
		case '5': digitstr = "five"
		case '6': digitstr = "six"
		case '7': digitstr = "seven"
		case '8': digitstr = "eight"
		case '9': digitstr = "nine"
		case '0': {
			if (getzero)
				digitstr = "zero"
			else
				return false
		}
		default : digitstr = "digiterror"
	}
	format(numbers, length, "%s %s", numbers, digitstr)

	return true
}

stock jghg_trim(stringtotrim[], len, charstotrim, bool:fromleft = true) {
	if (charstotrim <= 0)
		return

	if (fromleft) {
		new maxlen = strlen(stringtotrim)
		if (charstotrim > maxlen)
			charstotrim = maxlen

		format(stringtotrim, len, "%s", stringtotrim[charstotrim])
	}
	else {
		new maxlen = strlen(stringtotrim) - charstotrim
		if (maxlen < 0)
			maxlen = 0

		format(stringtotrim, maxlen, "%s", stringtotrim)
	}
}

public addrounds(id, level, cid) {
	if (!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)
	new arglength = strlen(arg)
	for (new i = 0; i < arglength; i++) {
		if (!isdigit(arg[i])) {
			if (i != 0 || arg[0] != '-') {
				console_print(id, "Error: Enter only numbers, ie ^"amx_addrounds 10^"")
				return PLUGIN_HANDLED
			}
		}
	}

	new roundstoadd = str_to_num(arg)

	if (roundstoadd == 0) {
		console_print(id, "Error: Well duuuh. Enter a positive or negative value, ie ^"amx_addrounds 10^"")
		return PLUGIN_HANDLED
	}

	new originalmaxrounds = get_cvar_num("mp_maxrounds")

	new newmaxrounds = originalmaxrounds + roundstoadd

	if (newmaxrounds < 1)
		newmaxrounds = 1

	new roundschanged = newmaxrounds - originalmaxrounds

	new Float:displayrounds = float(roundschanged)
	displayrounds *= displayrounds
	displayrounds = floatsqroot(displayrounds)

	console_print(id, "%sing %d rounds...", roundschanged > 0 ? "Add" : "Remov", floatround(displayrounds))

	set_cvar_num("mp_maxrounds", newmaxrounds)

	conRoundsLeft(id)

	return PLUGIN_HANDLED
}

public plugin_init() {
	register_plugin(PLUGINNAME, VERSION, AUTHOR)
	register_clcmd("say round", "sayRoundsLeft")
	register_clcmd("say rounds", "sayRoundsLeft")
 	register_clcmd("say roundleft", "sayRoundsLeft")
 	register_clcmd("say roundsleft", "sayRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_roundsleft", "conRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_addrounds", "addrounds", ADMIN_CFG, "<rounds> - add/remove remaining rounds")
	//register_event("TeamScore", "teamScore", "ab")
	//register_event("ResetHUD", "newround_event", "b")
	/*
	register_event("SendAudio","endround_event","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
	register_event("TextMsg","endround_event","a","2&#Game_C","2&#Game_w")
	register_event("TextMsg","endround_event","a","2&#Game_will_restart_in")
	*/
	/*
	register_logevent("death_event",5,"1=killed","3=with")
	// L 03/08/2004 - 13:32:34: "xian<2><BOT><CT>" killed "SuperKaka<1><BOT><TERRORIST>" with "usp"
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	*/
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	/*register_logevent("endround_event", 3, "2=Round_End")
	register_logevent("endround_event", 3, "1=Round_End")
	register_logevent("endround_event", 3, "0=Round_End")
	register_logevent("endround_event", 3, "3=Round_End")*/
	register_logevent("endround_event", 2, "0=World triggered", "1=Round_End")
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#6

Post by Muhammet20 » 5 years ago

Jack GamePlay wrote: 5 years ago Try:

Code: Select all

new const PLUGINNAME[] = "Roundsleft"
new const VERSION[] = "2.4"
new const AUTHOR[] = "MisterJ"
/*

THANKS
========
Johnny got his gun : He created the concept and made the first version.


ROUNDSLEFT
==========
Allows the users to "say roundsleft" and remaining rounds will be displayed.
This is useful if you are using default hlds cvar mp_maxrounds set to some value.
There is also a command "amx_roundsleft" to view remaining rounds in console.


HOW TO INSTALL
==============
1. Name this file roundsleft.sma.
2. Compile it into roundsleft.amxx.
3. Put roundsleft.amxx into amxmodx/plugins directory.
4. Open up amxmodx/configs/plugins.ini and add a line to the end saying: roundsleft.amx
5. Done. Type reload in your server.


HOW TO USE
==========
say roundsleft, say rounds, say roundleft, say round
- all these will respond with remaining rounds if mp_maxrounds is set to anything higher than 0.

amx_roundsleft
- displays remaining rounds in console. Works also from server console.


VERSION
========
2.4

*/

#include <zombie_escape>
#include <engine>

// Globals above

public sayRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id) {
		if (maxRounds == 0) {
			client_print(0, print_chat, "No rounds limit.")
		}
		else {
			new roundsleft = maxRounds - (ze_get_round_number())
			client_print(0, print_chat, "Remaining rounds: %d", roundsleft)
			speakroundsleft(id, roundsleft)
		}
	}

	return PLUGIN_CONTINUE
}

speakroundsleft(id, roundsleft) {
	new numbers[256]
	getnumbers(roundsleft, numbers, 255)
	client_cmd(id, "spk ^"%s round remaining^"", numbers)
	//client_print(0, print_chat, "%s round%s remain", numbers, roundsleft > 1 ? "s" : "")
}

public conRoundsLeft(id) {
	new maxRounds = get_cvar_num("mp_maxrounds")
	if (id)	console_print(id,"Remaining rounds: %d",maxRounds - (ze_get_round_number()))
	else server_print("Remaining rounds: %d",maxRounds - (ze_get_round_number()))

	return PLUGIN_HANDLED
}

/*
public newround_event(id) {
	if (is_user_bot(id))
		return PLUGIN_CONTINUE

	new maxRounds = get_cvar_num("mp_maxrounds")
	if (maxRounds) {
		set_hudmessage(0, 100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
		show_hudmessage(id, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
		client_print(id, print_chat, "%d rounds remaining", maxRounds - (g_teamScore[0] + g_teamScore[1]))
	}

	return PLUGIN_CONTINUE
}
*/

public endround_event() {
	server_print("endround_event, %d entities in game", entity_count())
	set_task(2.0, "endofroundspk")

	return PLUGIN_CONTINUE
}

public endofroundspk() {
	//server_print("endofroundspk")
	new maxRounds = get_cvar_num("mp_maxrounds")
	new roundsleft = maxRounds - (ze_get_round_number())
	new nextmap[64]
	get_cvar_string("amx_nextmap", nextmap, 63)
	if (maxRounds) {
		set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)

		if (roundsleft == 100)
		show_hudmessage(0, "100 rounds remaining", roundsleft)

		if (roundsleft == 80)
		show_hudmessage(0, "80 rounds remaining", roundsleft)

		if (roundsleft == 60)
		show_hudmessage(0, "60 rounds remaining", roundsleft)		

		if (roundsleft == 50)
		show_hudmessage(0, "50 rounds remaining", roundsleft)

		if (roundsleft == 40)
		show_hudmessage(0, "40 rounds remaining", roundsleft)	

		if (roundsleft == 30)
		show_hudmessage(0, "30 rounds remaining", roundsleft)		

		if (roundsleft == 20)
		show_hudmessage(0, "20 rounds remaining", roundsleft)

		if (roundsleft == 10)
		show_hudmessage(0, "10 rounds remaining", roundsleft)

		if (roundsleft == 5)
		show_hudmessage(0, "5 rounds remaining", roundsleft)
		
		if (roundsleft == 1)
		show_hudmessage(0, "The last round", roundsleft)

		if (roundsleft == 0)
		show_hudmessage(0, "Nextmap is %s...", nextmap)
			
		}


	if (roundsleft > 0) {

		if (roundsleft == 90)
		client_cmd(0, "spk ^"ninety round remaining^"")

		if (roundsleft == 80)
		client_cmd(0, "spk ^"eighty round remaining^"")

		if (roundsleft == 70)
		client_cmd(0, "spk ^"seventy round remaining^"")

		if (roundsleft == 60)
		client_cmd(0, "spk ^"sixty round remaining^"")		

		if (roundsleft == 50)
		client_cmd(0, "spk ^"fifty round remaining^"")
	
		if (roundsleft == 40)
		client_cmd(0, "spk ^"fourty round remaining^"")

		if (roundsleft == 30)
		client_cmd(0, "spk ^"thirty round remaining^"")

		if (roundsleft == 20)
		client_cmd(0, "spk ^"twenty round remaining^"")

		if (roundsleft == 10)
		client_cmd(0, "spk ^"ten round remaining^"")

		if (roundsleft == 5)
		client_cmd(0, "spk ^"five round remaining^"")

		if (roundsleft == 1)
		client_cmd(0, "spk ^"the last round^"")

		}
	

	}



stock getnumbers(number, wordnumbers[], length) {
	if (number < 0) {
		format(wordnumbers, length, "error")
		return
	}

	new numberstr[20]
	num_to_str(number, numberstr, 19)
	new stlen = strlen(numberstr), bool:getzero = false, bool:jumpnext = false
	if (stlen == 1)
		getzero = true

	do {
		if (jumpnext)
			jumpnext = false
		else if (numberstr[0] != '0') {
			switch (stlen) {
				case 9: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " million" : "")
				}
				case 8: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (jumpnext)
						format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 7: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s million", wordnumbers)
				}
				case 6: {
					if (getsingledigit(numberstr[0], wordnumbers, length))
						format(wordnumbers, length, "%s hundred%s", wordnumbers, numberstr[1] == '0' && numberstr[2] == '0' ? " thousand" : "")
				}
				case 5: {
					jumpnext = gettens(wordnumbers, length, numberstr)
					if (numberstr[0] == '1' || numberstr[1] == '0')
						format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 4: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s thousand", wordnumbers)
				}
				case 3: {
					getsingledigit(numberstr[0], wordnumbers, length)
					format(wordnumbers, length, "%s hundred", wordnumbers)
				}
				case 2: jumpnext = gettens(wordnumbers, length, numberstr)
				case 1: {
					getsingledigit(numberstr[0], wordnumbers, length, getzero)
					break // could've trimmed, but of no use here
				}
				default: {
					format(wordnumbers, length, "%s TOO LONG", wordnumbers)
					break
				}
			}
		}

		jghg_trim(numberstr, length, 1)
		stlen = strlen(numberstr)
	}
	while (stlen > 0)

	// Trim a char from left if first char is a space (very likely)
	if (wordnumbers[0] == ' ')
		jghg_trim(wordnumbers, length, 1)
}

// Returns true if next char should be jumped
stock bool:gettens(wordnumbers[], length, numberstr[]) {
	new digitstr[11], bool:dont = false, bool:jumpnext = false
	switch (numberstr[0]) {
		case '1': {
			jumpnext = true
			switch (numberstr[1]) {
				case '0': digitstr = "ten"
				case '1': digitstr = "eleven"
				case '2': digitstr = "twelve"
				case '3': digitstr = "thirteen"
				case '4': digitstr = "fourteen"
				case '5': digitstr = "fifteen"
				case '6': digitstr = "sixteen"
				case '7': digitstr = "seventeen"
				case '8': digitstr = "eighteen"
				case '9': digitstr = "nineteen"
				default: digitstr = "TEENSERROR"
			}
		}
		case '2': digitstr = "twenty"
		case '3': digitstr = "thirty"
		case '4': digitstr = "fourty"
		case '5': digitstr = "fifty"
		case '6': digitstr = "sixty"
		case '7': digitstr = "seventy"
		case '8': digitstr = "eighty"
		case '9': digitstr = "ninety"
		case '0': dont = true // do nothing
		default : digitstr = "TENSERROR"
	}
	if (!dont)
		format(wordnumbers, length, "%s %s", wordnumbers, digitstr)

	return jumpnext
}

// Returns true when sets, else false
stock getsingledigit(digit[], numbers[], length, bool:getzero = false) {
	new digitstr[11]
	switch (digit[0]) {
		case '1': digitstr = "one"
		case '2': digitstr = "two"
		case '3': digitstr = "three"
		case '4': digitstr = "four"
		case '5': digitstr = "five"
		case '6': digitstr = "six"
		case '7': digitstr = "seven"
		case '8': digitstr = "eight"
		case '9': digitstr = "nine"
		case '0': {
			if (getzero)
				digitstr = "zero"
			else
				return false
		}
		default : digitstr = "digiterror"
	}
	format(numbers, length, "%s %s", numbers, digitstr)

	return true
}

stock jghg_trim(stringtotrim[], len, charstotrim, bool:fromleft = true) {
	if (charstotrim <= 0)
		return

	if (fromleft) {
		new maxlen = strlen(stringtotrim)
		if (charstotrim > maxlen)
			charstotrim = maxlen

		format(stringtotrim, len, "%s", stringtotrim[charstotrim])
	}
	else {
		new maxlen = strlen(stringtotrim) - charstotrim
		if (maxlen < 0)
			maxlen = 0

		format(stringtotrim, maxlen, "%s", stringtotrim)
	}
}

public addrounds(id, level, cid) {
	if (!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)
	new arglength = strlen(arg)
	for (new i = 0; i < arglength; i++) {
		if (!isdigit(arg[i])) {
			if (i != 0 || arg[0] != '-') {
				console_print(id, "Error: Enter only numbers, ie ^"amx_addrounds 10^"")
				return PLUGIN_HANDLED
			}
		}
	}

	new roundstoadd = str_to_num(arg)

	if (roundstoadd == 0) {
		console_print(id, "Error: Well duuuh. Enter a positive or negative value, ie ^"amx_addrounds 10^"")
		return PLUGIN_HANDLED
	}

	new originalmaxrounds = get_cvar_num("mp_maxrounds")

	new newmaxrounds = originalmaxrounds + roundstoadd

	if (newmaxrounds < 1)
		newmaxrounds = 1

	new roundschanged = newmaxrounds - originalmaxrounds

	new Float:displayrounds = float(roundschanged)
	displayrounds *= displayrounds
	displayrounds = floatsqroot(displayrounds)

	console_print(id, "%sing %d rounds...", roundschanged > 0 ? "Add" : "Remov", floatround(displayrounds))

	set_cvar_num("mp_maxrounds", newmaxrounds)

	conRoundsLeft(id)

	return PLUGIN_HANDLED
}

public plugin_init() {
	register_plugin(PLUGINNAME, VERSION, AUTHOR)
	register_clcmd("say round", "sayRoundsLeft")
	register_clcmd("say rounds", "sayRoundsLeft")
 	register_clcmd("say roundleft", "sayRoundsLeft")
 	register_clcmd("say roundsleft", "sayRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_roundsleft", "conRoundsLeft", 0, "- displays remaining rounds")
 	register_concmd("amx_addrounds", "addrounds", ADMIN_CFG, "<rounds> - add/remove remaining rounds")
	//register_event("TeamScore", "teamScore", "ab")
	//register_event("ResetHUD", "newround_event", "b")
	/*
	register_event("SendAudio","endround_event","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
	register_event("TextMsg","endround_event","a","2&#Game_C","2&#Game_w")
	register_event("TextMsg","endround_event","a","2&#Game_will_restart_in")
	*/
	/*
	register_logevent("death_event",5,"1=killed","3=with")
	// L 03/08/2004 - 13:32:34: "xian<2><BOT><CT>" killed "SuperKaka<1><BOT><TERRORIST>" with "usp"
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	*/
	// L 03/08/2004 - 13:32:34: World triggered "Round_End"
	/*register_logevent("endround_event", 3, "2=Round_End")
	register_logevent("endround_event", 3, "1=Round_End")
	register_logevent("endround_event", 3, "0=Round_End")
	register_logevent("endround_event", 3, "3=Round_End")*/
	register_logevent("endround_event", 2, "0=World triggered", "1=Round_End")
}
its not working for me beacuse my zombie escape mod is v2.2 , and i edited so much things on it
if i change the version it will be gone , :(

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#7

Post by Night Fury » 5 years ago

That's why i'm not going to help you with anything unless it's related to ZE 1.3.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#8

Post by Muhammet20 » 5 years ago

Jack GamePlay wrote: 5 years ago That's why i'm not going to help you with anything unless it's related to ZE 1.3.
man why you saying this , np , i don't want this plugin , i can't use ZE 1.3 , because i edited some thing on ZE V2.2
And I Don't Said You Don't Helping Me , Man I Found 2 Or 3 Plugins With Your Help

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#9

Post by Spir0x » 5 years ago

bruh we dont even speak about old mods or another mods exept "ZE v1.3" here.
What's your server ip ?

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#10

Post by Muhammet20 » 5 years ago

Spir0x wrote: 5 years ago bruh we dont even speak about old mods or another mods exept "ZE v1.3" here.
What's your server ip ?
i didn't hosted my server but it's ready i just adding some simple addons and some admin commands

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#11

Post by Spir0x » 5 years ago

Okay nevermind.

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#12

Post by sPe3doN » 5 years ago

Not working jack it's the same problem it's show me every round
Round remaining: 6
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#13

Post by Muhammet20 » 5 years ago

sPe3doN wrote: 5 years ago Not working jack it's the same problem it's show me every round
Round remaining: 6
try this:
__________

Code: Select all

#include <amxmodx>
#include <amxmisc>

new MaxRounds
new RoundCount

public plugin_init() {

	register_plugin("roundsleft", "", "Muhammet Kaya")
	register_logevent("round_end", 2, "1=Round_End")
	register_event("TextMsg", "new_map_or_restart", "a", "2&#Game_C", "2&#Game_w")
	register_clcmd("say roundsleft","ShowRoundsLeft")
	MaxRounds = get_cvar_pointer("mp_maxrounds")
}
public round_end() 
{ 
    RoundCount++ 
}

public new_map_or_restart() 
{ 
    RoundCount = 0 
}
public ShowRoundsLeft(id)
{
	if(get_pcvar_num(MaxRounds) == 0)
	{
		client_print(id,print_chat, "No Rounds Limit")
	}
	if(get_pcvar_num(MaxRounds) > 0)
	{
		client_print(id,print_chat, "Rounds Left: %d", get_pcvar_num(MaxRounds) - RoundCount)
	}
}

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests