Discord sunucumuz açılmıştır, hepinizi bekleriz

https://discord.gg/43gGDQe6tS

Stringden harf almak

Oyunda karşılaştığınız hatalar , oyun hakkında genel bilgiler

Moderatör: Moderatörler


Schwartzkopf
Mesajlar: 13
Kayıt: Pzr Nis 17, 2022 6:54 pm

Stringden harf almak

Mesaj gönderen Schwartzkopf »

if(containi(msg,"!t") != -1) şeklinde kullanmayı deneyin.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
HakimKILLER44
Mesajlar: 155
Kayıt: Cum Ağu 13, 2021 8:56 pm
Konum: Azerbeycan
Server Ip/DNS: 147.185.221.16:26504

Stringden harf almak

Mesaj gönderen HakimKILLER44 »

Simdi calisti. Yardim Eden herkese coklu tesekkurler

Kod lazim olursa diye yazicam buraya :

Kod: Tümünü seç

// Stock: ZE Color Print
stock ze_color_p(index, const text[], any:...)
{
	new const teams[][] = {"", "TERRORIST", "CT", "SPECTATOR"}
	new msg[128], main_team, team[100]
	vformat(msg, charsmax(msg), text, 3)
	
	if (containi(msg, "!t") != -1)
		team = "CT"
	if (containi(msg, "!y") != -1)
		team = "TERRORIST"
	if (containi(msg, "!d") != -1)
		team = ""
	
	replace_all(msg, charsmax(msg), "!g", "^x04")
	replace_all(msg, charsmax(msg), "!n", "^x01")
	replace_all(msg, charsmax(msg), "!t", "^x03")
	replace_all(msg, charsmax(msg), "!y", "^x03")
	replace_all(msg, charsmax(msg), "!d", "^x03")
	
	if (index == 0)
	{
		for (new id = 1; id <= get_maxplayers(); id++)
		{
			if (!is_user_connected(id))
				continue
			
			main_team = get_user_team(id)
			
			message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, id)
			write_byte(id)
			write_string(team)
			message_end()
			
			message_begin(MSG_ONE, get_user_msgid("SayText"), _, id)
			write_byte(id)
			write_string(msg)
			message_end()
			
			message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, id)
			write_byte(id)
			write_string(teams[main_team])
			message_end()
		}
	}
	else
	{
		main_team = get_user_team(index)
		
		message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, index)
		write_byte(index)
		write_string(team)
		message_end()
		
		message_begin(MSG_ONE, get_user_msgid("SayText"), _, index)
		write_byte(index)
		write_string(msg)
		message_end()
		
		message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, index)
		write_byte(index)
		write_string(teams[main_team])
		message_end()
	}
}

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Taha Demirbaş
Mesajlar: 10424
Kayıt: Cum Tem 08, 2016 10:05 pm
Konum: Türkiye
İletişim:

Stringden harf almak

Mesaj gönderen Taha Demirbaş »

replace kullanman daha iyi olur. for looplarından kurtulmuş olursun. Başta deseydin keşke

Link:
Linklerini gizle
Linki Kopyala
Cevapla