IosifR Posted February 1, 2021 Posted February 1, 2021 Cum dezactivez Global Chatul? Când scriu ceva să vadă doar cei de langa mine nu și aia de la 200m
khain.dev Posted February 19, 2021 Posted February 19, 2021 (edited) /* OnPlayerText */ public OnPlayerText(playerid, text[]) { new mesid[128]; format(mesid, sizeof(mesid), "- %s[%d]: %s", GetPlayerName(playerid), playerid, text); ProxDetector(playerid, 13.0, 0xFFFAFAAA, mesid); SetPlayerChatBubble(playerid, text, 0xFFFAFAAA, 15.0, 10000); return 0; } /* undeva in gamemode */ stock ProxDetector(playerid, Float:max_range, color, string[], Float:max_ratio = 1.6) { new Float:pos_x, Float:pos_y, Float:pos_z, Float:range, Float:range_ratio, Float:range_with_ratio, clr_r, clr_g, clr_b, Float:color_r, Float:color_g, Float:color_b; if(!GetPlayerPos(playerid, pos_x, pos_y, pos_z)) return false; color_r = float(color >> 24 & 0xFF); color_g = float(color >> 16 & 0xFF); color_b = float(color >> 8 & 0xFF); range_with_ratio = max_range * max_ratio; foreach(new i: Player) { if(!IsPlayerStreamedIn(i, playerid)) continue; range = GetPlayerDistanceFromPoint(i, pos_x, pos_y, pos_z); if(range > max_range) continue; range_ratio = (range_with_ratio - range) / range_with_ratio; clr_r = floatround(range_ratio * color_r); clr_g = floatround(range_ratio * color_g); clr_b = floatround(range_ratio * color_b); SendClientMessage(i, (color & 0xFF) | (clr_b << 8) | (clr_g << 16) | (clr_r << 24), string); } SendClientMessage(playerid, color, string); return true; } Edited February 19, 2021 by khain.dev
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now