Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnGameModeInit()
- {
- new count;
- count = GetTickCount();
- for(new i = 0; i < 5000; i++)
- {
- ProxDetector(30.0, 0, "Text", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- printf("by me %d", GetTickCount() - count);
- count = GetTickCount();
- for(new i = 0; i < 5000; i++)
- {
- ProxDetector_OK(30.0, 0, "Text", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- printf("OKStyle %d", GetTickCount() - count);
- count = GetTickCount();
- for(new i = 0; i < 50000; i++)
- {
- ProxDetector(30.0, 0, "Text", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- printf("by me %d", GetTickCount() - count);
- count = GetTickCount();
- for(new i = 0; i < 50000; i++)
- {
- ProxDetector_OK(30.0, 0, "Text", COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- printf("by OKStyle %d", GetTickCount() - count);
- return 1;
- }
- stock ProxDetector(Float:range, playerid, text[], Color1, Color2, Color3, Color4, Color5)
- {
- new Float: Pos[3], Float: Radius;
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- Radius = GetPlayerDistanceFromPoint(i, Pos[0], Pos[1], Pos[2]);
- if (Radius < range / 16) SendClientMessage(i, Color1, text);
- else if(Radius < range / 8) SendClientMessage(i, Color2, text);
- else if(Radius < range / 4) SendClientMessage(i, Color3, text);
- else if(Radius < range / 2) SendClientMessage(i, Color4, text);
- else if(Radius < range) SendClientMessage(i, Color5, text);
- }
- }
- return 1;
- }
- stock ProxDetector_OK(Float:radius = 30.0, playerid, text[], col1 = 0xCECECEFF, col2 = 0xB8B7B7FF, col3 = 0x999999FF, col4 = 0x6B6B6BFF, col5 = 0x434343FF)
- {
- new Float:x, Float:y, Float:z, virtualworld = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
- GetPlayerPos(playerid, x, y, z);
- for(new i = GetMaxPlayers() - 1; i != -1; i--)
- {
- if(virtualworld != GetPlayerVirtualWorld(i) || interior != GetPlayerInterior(i)) continue;
- if(IsPlayerInRangeOfPoint(i, radius / 16, x, y, z)) SendClientMessage(i, col1, text);
- else if(IsPlayerInRangeOfPoint(i, radius / 8, x, y, z)) SendClientMessage(i, col2, text);
- else if(IsPlayerInRangeOfPoint(i, radius / 4, x, y, z)) SendClientMessage(i, col3, text);
- else if(IsPlayerInRangeOfPoint(i, radius / 2, x, y, z)) SendClientMessage(i, col4, text);
- else if(IsPlayerInRangeOfPoint(i, radius, x, y, z)) SendClientMessage(i, col5, text);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement