Resolved rounds left

Unpaid Requests, Public Plugins
User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 199
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

rounds left

#1

Post by sPe3doN » 9 Months 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")
}

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 199
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#2

Post by sPe3doN » 9 Months Ago

Any one ?

[ Post made via Android ]

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 199
Joined: 2 Years Ago
Has thanked: 14 times
Been thanked: 7 times
Age: 20
Contact:

#3

Post by sPe3doN » 8 Months Ago

Come on ppl any one ?

[ Post made via Android ]

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 391
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#4

Post by Muhammet20 » 8 Months Ago

sPe3doN wrote:
9 Months 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
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 609
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#5

Post by Mohamed Alaa » 8 Months 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 web projects.

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 391
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#6

Post by Muhammet20 » 8 Months Ago

Jack GamePlay wrote:
8 Months 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 , :(
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 609
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#7

Post by Mohamed Alaa » 8 Months Ago

That's why i'm not going to help you with anything unless it's related to ZE 1.3.

[ Post made via Android ]
Want your own mod edition? PM me.
Accepting web projects.

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 391
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#8

Post by Muhammet20 » 8 Months Ago

Jack GamePlay wrote:
8 Months 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
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#9

Post by Spir0x » 8 Months Ago

bruh we dont even speak about old mods or another mods exept "ZE v1.3" here.
What's your server ip ?
I trynna make money, not friends.

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 391
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#10

Post by Muhammet20 » 8 Months Ago

Spir0x wrote:
8 Months 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
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests