[AJUDA] Sobre Comando
#1

Pessoal , tenho meu gm de A/D mas ele nгo tem o Comando /slap (TAPA) eu venho pedir que alguem "Crie" para mim e poste '-'

pawn Код:
PLZZ
Reply
#2

pawn Код:
if(strcmp(cmd, "/tapa", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /tapa [ id ]");
                return 1;
            }
            new playa;
            new Float:slx, Float:sly, Float:slz;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >=1)//Definiзгo Para Admins
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerPos(playa, slx, sly, slz);
                        SetPlayerPos(playa, slx, sly, slz+12);
                        PlayerPlaySound(playa, 1130, slx, sly, slz+12);
                        printf("AVISO: %s slapped %s",sendername,  giveplayer);
                        format(string, sizeof(string), "AVISO: %s ganhou um tapa de: %s",giveplayer ,sendername);
                        SendClientMessageToAll(COLOR_LIGHTRED,string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Voce nгo estб autorizado a usar este comando!");
            }
        }
        return 1;
    }
Reply
#3

Pode usar este acima porem nao recomendo, recomendo o uso de zcmd + sscanf, onde o comando ficaria da seguinte maneira:

pawn Код:
CMD:tapa(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 0)//definicao dos admins
    {
        new id,name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"Use /Tapa [ID/Nome]");
        GetPlayerName(playerid,name,sizeof(name));
        GetPlayerName(id,name2,sizeof(name2));
        GetPlayerPos(id,x,y,z);
        SetPlayerPos(id,x,y,z+7);// +7 fara o player subir
        new str[128];
        format(str,128,"%s Ganhou um Tapa de %s",name2,name);
        SendClientMessageToAll(-1,str);
    }
    return 1;
}
Reply
#4

pawn Код:
//news
enum pInfo
{
    pAdmin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];


//CommandText
new idx,cmd[256],tmp[256],para1;
    cmd = strtok(cmdtext, idx);
   
    if(strcmp(cmd, "/tapa", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
        SendClientMessage(playerid, 0xBFC0C2FF, "USE: /tapa [ID/Nome]");
        return 1;
        }
        new plid;
        new Float:shealth;
        new Float:slx, Float:sly, Float:slz;
        plid = ReturnUser(tmp);
        if (PlayerInfo[playerid][pAdmin] >=1)
        {
        if(IsPlayerConnected(plid))
        {
        if(plid != INVALID_PLAYER_ID)
        {
        GetPlayerHealth(plid, shealth);
        SetPlayerHealth(plid, shealth-5);
        GetPlayerPos(plid, slx, sly, slz);
        SetPlayerPos(plid, slx, sly, slz+5);
        PlayerPlaySound(plid, 1130, slx, sly, slz+5);
        }
        }
        }
        else
        {
        SendClientMessage(playerid, 0xB4B5B7FF, "Vocк Nгo й Um Admin!");
        }
        }
        return 1;
    }
Reply
#5

Olha cara aqui estб o comando que pedio:

pawn Код:
//NO COMEЗO DO GM
#define Branco                                                                      0xFFFFFFAA
#define Vermelho                                                                   0xFF0000AA
#define outraadm                                                                   0x33AAFFFF


//NO MEIO DO GM

if(strcmp(cmd, "/tapa", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] > 1){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "Digite: /tapa [id]");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new interiordele;
interiordele = GetPlayerInterior(plid);
SetPlayerInterior(plid, interiordele);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(plid, X, Y, Z);
SetPlayerPos(plid, X, Y, Z +50);
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "[INFO] O Adminstrador %s (%d) te deu um tapa!", aname,playerid);
SendClientMessage(plid,outraadm, string);
SendClientMessage(playerid, Branco, "* Comando efetuado com sucesso!");
return 1;
}else{
SendClientMessage(playerid, Vermelho, "[ERRO] ID invбlido");
return 1;
}
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)