Pages

Ads 468x60px


[FilterScript] Conhecer Player

O que é?

Boas pessoal, isso aqui é um sistema básico que eu fiz de conhecer players. Foi eu que criei totalmente, apos alguem me ter pedido, entao decidi publicar agora. Este nao é o sistema que eu uso em meu server, o meu é mais complexo, mas voce pode melhorar este claro.

Como funciona?

Voce terá de criar uma pasta com o nome Conhecer dentro da pasta scriptfiles de seu servidor e o servidor automaticamente criará um ficheiro para cada player. Para ficar a conhecer basta dizer seu nome, tal como ele é, se tiver "_" tem que por tambem e o seu nome aparecerá para quem estiver perto. o mesmo terao de fazer os outros para voce ver.

Nota : Tem de baixar o sINI - http://forum.sa-mp.com/showthread.ph...highlight=sini

pawn Code:
#include <a_samp> #include <sINI> public OnGameModeInit() {     file_OS();     return 1; } public OnPlayerSpawn(playerid) {     if(GetPVarInt(playerid,"primeiro_spawn")==0&&!IsPlayerNPC(playerid))     {         for(new i;i<MAX_PLAYERS;++i)         {             if(i!=playerid&&IsPlayerConnected(i)&&!IsPlayerNPC(i))             {                 new nomeplayer[24];                 format(nomeplayer,24,"%s",GetPlayerNameEx(i));                 SetPVarInt(playerid,nomeplayer,0);                 format(nomeplayer,24,"%s",GetPlayerNameEx(playerid));                 SetPVarInt(i,nomeplayer,0);                 ShowPlayerNameTagForPlayer(i,playerid,false);                 ShowPlayerNameTagForPlayer(playerid,i,false);             }         }         new ficheiroc[40];         format(ficheiroc,40,"Conhecer/%s.ini",GetPlayerNameEx(playerid));         if(!fexist(ficheiroc))         {             file_Create(ficheiroc);             file_Open(ficheiroc);             format(ficheiroc,24,"%s",GetPlayerNameEx(playerid));             file_SetVal(ficheiroc,1);             format(ficheiroc,40,"Conhecer/%s.ini",GetPlayerNameEx(playerid));             file_Save(ficheiroc);             file_Close();         }         new nomeplayeri[24],nomeplayer[24];         for(new i;i<MAX_PLAYERS;++i)         {             GetPlayerName(i,nomeplayeri,24);             if(!IsPlayerNPC(i)&&IsPlayerConnected(i))             {                 format(ficheiroc,40,"Conhecer/%s.ini",nomeplayer);                 file_Open(ficheiroc);                 if(file_IsKey(nomeplayeri))                 {                     SetPVarInt(playerid,nomeplayeri,file_GetVal(nomeplayeri));                     if(GetPVarInt(playerid,nomeplayeri)==1)                     {                         ShowPlayerNameTagForPlayer(i,playerid,true);                     }                     else if(GetPVarInt(playerid,nomeplayeri) == 0)                     {                         ShowPlayerNameTagForPlayer(i,playerid,false);                     }                 }                 else                 {                     file_SetVal(nomeplayeri,0);                     file_Save(ficheiroc);                 }                 file_Close();                 format(ficheiroc,40,"Conhecer/%s.ini",nomeplayeri);                 file_Open(ficheiroc);                 if(file_IsKey(nomeplayer))                 {                     SetPVarInt(i,nomeplayer,file_GetVal(nomeplayer));                     if(GetPVarInt(i,nomeplayer)==1)                     {                         ShowPlayerNameTagForPlayer(playerid,i,true);                     }                     else if(GetPVarInt(i,nomeplayer)==0)                     {                         ShowPlayerNameTagForPlayer(playerid,i,false);                     }                 }                 else                 {                     file_SetVal(nomeplayer,0);                     file_Save(ficheiroc);                 }                 file_Close();             }         }         SetPVarInt(playerid,"primeiro_spawn",1);     }     return 1; } public OnPlayerText(playerid, text[]) {     new ficheiroc[40];     format(ficheiroc,24,"%s",GetPlayerNameEx(playerid));     if(strfind(text,ficheiroc,true)!=-1)     {         new nomeplayeri[24];         for(new i;i<MAX_PLAYERS;++i)         {             if(i!=playerid&&IsPlayerConnected(i)&&!IsPlayerNPC(i))             {                 GetPlayerName(i,nomeplayeri,24);                 format(ficheiroc,40,"Conhecer/%s.ini",nomeplayeri);                 file_Open(ficheiroc);                 if(ProxDetectorS(5.0,playerid,i))                 {                     format(ficheiroc,24,"%s",GetPlayerNameEx(playerid));                     if(GetPVarInt(i,ficheiroc)==0)                     {                         format(ficheiroc,24,"%s",nomeplayeri);                         file_SetVal(ficheiroc,1);                         SetPVarInt(playerid,ficheiroc,1);                         ShowPlayerNameTagForPlayer(i,playerid,true);                     }                 }                 format(ficheiroc,40,"Conhecer/%s.ini",nomeplayeri);                 file_Save(ficheiroc);                 file_Close();             }         }     }     return 1; } public OnPlayerConnect(playerid) {     SetPVarInt(playerid,"primeiro_spawn",0);     return 1; } //outros, creditos para criadores. stock GetPlayerNameEx(playerid) {     new NomePlayer[24];     return GetPlayerName(playerid,NomePlayer,24); } forward ProxDetectorS(Float:radi, playerid, targetid); public ProxDetectorS(Float:radi, playerid, targetid) {     if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))     {         new Float:posx, Float:posy, Float:posz;         new Float:oldposx, Float:oldposy, Float:oldposz;         new Float:tempposx, Float:tempposy, Float:tempposz;         GetPlayerPos(playerid, oldposx, oldposy, oldposz);         //radi = 2.0; //Trigger Radius         GetPlayerPos(targetid, posx, posy, posz);         tempposx = (oldposx -posx);         tempposy = (oldposy -posy);         tempposz = (oldposz -posz);         //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))         {             return 1;         }     }     return 0; }