Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- SuYaNw's Icon Streamer
- - Criado por G. SuYaNw Dácio.
- Aumente 5x o limite de icones no game,
- tudo otimizado e simplificado.
- Parâmetros:
- sCreateMapIcon(Modelo, Cor, Float:X, Float:Y, Float:Z);
- */
- #define MAX_MAPICONS (500) // Máximo de ícones suportados
- #define MAX_DISTANCE Float:380.0 // Máximo de distância para exibir o ícone (380.0 PADRÃO)
- #define SHOW_DEBUGGING false // Função para exibir debugging
- enum siconx
- {
- Float:Icon_X, Float:Icon_Y, Float:Icon_Z,
- IconModel, Cor
- }
- new
- sMapIcons[MAX_MAPICONS][siconx],
- LastPlayerIcon[MAX_PLAYERS char],
- CurrentIconID
- ;
- stock sCreateMapIcon(map_model, cor,Float:mapiconx,Float:mapicony,Float:mapiconz)
- {
- if(CurrentIconID == MAX_MAPICONS)
- {
- printf("[S.I.S]: Limite de icones atingido, por favor, diminuia.");
- return false;
- }
- sMapIcons[CurrentIconID][Icon_X] = mapiconx;
- sMapIcons[CurrentIconID][Icon_Y] = mapicony;
- sMapIcons[CurrentIconID][Icon_Z] = mapiconz;
- sMapIcons[CurrentIconID][IconModel] = map_model;
- sMapIcons[CurrentIconID][Cor] = cor;
- #if SHOW_DEBUGGING == true
- {
- printf("[S.I.S]: Novo ícone criado: ID Interno: (%i) | Modelo: (%i) | Cor: (%h)| Posição(X:%f, Y:%f, Z:%f)", CurrentIconID, map_model, cor, mapiconx, mapicony, mapiconz);
- }
- #endif
- return CurrentIconID++;
- }
- stock ResetMapIcons(playerid){
- for(new i; i != CurrentIconID; ++i){
- RemovePlayerMapIcon(playerid, i);
- LastPlayerIcon{i} = -1;
- }
- }
- OnIconUpdate(); public OnIconUpdate()
- {
- for(new i, getMaxPlayers = GetMaxPlayers(); i != getMaxPlayers; ++i){
- if(IsPlayerConnected(i)){
- for(new e; e < CurrentIconID; ++e){
- if(IsPlayerInRangeOfPoint(i, MAX_DISTANCE, sMapIcons[e][Icon_X], sMapIcons[e][Icon_Y], sMapIcons[e][Icon_Z])){
- if(LastPlayerIcon{i} == e && LastPlayerIcon{i} != -1)
- {
- #if SHOW_DEBUGGING
- {
- printf("[S.I.S]: Erro ao exibir icone -> Icone já exibido (ID:%i)", e);
- }
- #endif
- continue;
- }
- SetPlayerMapIcon(i, e, sMapIcons[e][Icon_X], sMapIcons[e][Icon_Y], sMapIcons[e][Icon_Z], sMapIcons[e][IconModel], sMapIcons[e][Cor], 0);
- LastPlayerIcon{i} = CurrentIconID;
- }
- else{
- #if SHOW_DEBUGGING
- {
- printf("[S.I.S]: Icone destruido -> Distância máxima exedida, Dis: (%f radious)", MAX_DISTANCE);
- }
- #endif
- RemovePlayerMapIcon(i, e);
- LastPlayerIcon{i} = -1;
- }
- }
- }
- }
- return 1;
- }
- public OnGameModeInit()
- {
- print (#|| SuYaNw's Icon Stremaer carregado\n||#);
- print ("|| --> Configuração: ");
- printf("|| Máximo de ícones: %i ", MAX_MAPICONS);
- printf("|| Distância Máxima: %1.0f ", MAX_DISTANCE);
- printf("|| Teste Debugging: %d\n||\n||", SHOW_DEBUGGING);
- SetTimer("OnIconUpdate", 2000, true);
- return CallRemoteFunction(#sisOnGameModeInit, #);
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit sisOnGameModeInit
- forward sisOnGameModeInit();
- //
Add Comment
Please, Sign In to add comment