PHP код:
/*
Nгo retire os creditos afinal nгo foi vocк que fez!
Comandos
/SetTag (id) (tag) <-- este comando seta a tag no player
/UnSetTag (id) <-- Escomando retira a tag setada no player
Bom Como nгo uso zcmd nгo testei esse mais deve estar funcionando
*/
//Includes
#include <a_samp>
#include <dini>
#include <zcmd>
#include <sscanf2>
//...
#define LOCAL "tags.txt" //Local onde ficara salvo as tags setadas
#define COR_TAG 00FF00 //Coloque aqui a cor da tag em codigo HEX, Vermelho=FF0000 , Azul=0000FF , Amarelo=FFFF00 , Branco=FFFFFF , Preto=000000
#define LETRAS 3 // Tamanho minimo da tag
// Variaveis
new tag[MAX_PLAYERS];
new PlayerTag[MAX_PLAYERS][80];
//============================================================
public OnFilterScriptInit()
{
for(new all = 0; all < MAX_PLAYERS; ++all){if(IsPlayerConnected(all)){OnPlayerConnect(all);}}
print("\n--------------------------------------");
if (!dini_Exists(LOCAL)){
dini_Create(LOCAL);
print("\nscriptfiles/"#LOCAL" | Criado");
}
print(" /SetTag By [$]_Red_[MF] iniciado");
print("--------------------------------------\n");
return 1;
}
//============================================================
public OnFilterScriptExit()
{
//nada
return 1;
}
//============================================================
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Este Servidor usa sistema de Tag feito por [$]_Red_[MF]");
new string[80];
format(string,sizeof(string),"%s_usetag",pName(playerid));
tag[playerid] = dini_Int(LOCAL, string);
PlayerTag[playerid] = dini_Get(LOCAL, pName(playerid));
return 1;
}
//============================================================
public OnPlayerText(playerid, text[])
{
if(tag[playerid] == 1)
{
new string[164];
format(string,sizeof(string),"%s{FFFFFF}-[{"#COR_TAG"}%s{FFFFFF}]-(%i): %s",pName(playerid),PlayerTag[playerid],playerid,text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
}
else
{
CallRemoteFunction("OnPlayerText", "is", playerid, text);
return 0;
}
return 0;
}
//============================================================
CMD:settag(playerid, params[]) // Comando usado para setar a tag no player /settag (id) (Tag) ex: /settag (0) (DORITOS)
{
new id,tmp2[80];
if(sscanf(params, "ds[50]",id,tmp2)) return SendClientMessage(playerid,-1,"Use: /settag [id] [tag]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Vocк nгo tem permisгo para usar este comando");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}Player nгo conectado!");
if(strlen(tmp2) < LETRAS) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FFFFFF} A tag tem que ter pelomenos "#LETRAS" Letras");
static string[124],str[50];
format(str,sizeof(str),"%s",tmp2);
format(string,sizeof(string),"%s_usetag",pName(id));
dini_Set(LOCAL, pName(id), str);
dini_IntSet(LOCAL, string, 1);
tag[id] = 1;
PlayerTag[id] = str;
format(string,sizeof(string),"{FFFF00}[TAG]:{FFFFFF} Tag: {"#COR_TAG"}%s {FFFFFF}Setada para o player: {"#COR_TAG"}%s",tmp2,pName(id));
SendClientMessage(playerid, -1,string);
return true;
}
//============================================================
CMD:unsettag(playerid, params[]) // Comando usado para retirar a tag do player /unsettag (id)
{
new tmp1;
if(sscanf(params, "d",tmp1)) return SendClientMessage(playerid,-1,"Use: /unsettag [id]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Vocк nгo tem permisгo para usar este comando");
new string[124];
if(!IsPlayerConnected(tmp1)) return SendClientMessage(playerid, -1, "{FF0000}Player nгo conectado!");
format(string,sizeof(string),"%s_usetag",pName(tmp1));
dini_IntSet(LOCAL, string, 0);
tag[tmp1] = 0;
format(string,sizeof(string),"{FFFF00}[TAG]:{FFFFFF} A Tag: {"#COR_TAG"}%s {FFFFFF}Foi retirada de {"#COR_TAG"}%s",PlayerTag[playerid],pName(tmp1));
SendClientMessage(playerid, -1,string);
PlayerTag[tmp1] = "";
return true;
}
//============================================================
stock pName(playerid){//pega nome do player
static pname[24];GetPlayerName(playerid, pname, 24);
return pname;}
//============================================================