SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 21/09/2019, 11:59 PM   #1
l3eksz
Big Clucker
 
l3eksz's Avatar
 
Join Date: Nov 2018
Location: Behind you
Posts: 165
Reputation: 2
Default Comando tapa

Fiz um comando para dar tapa em um player mas acontece que:
O comando nao da um "tapa" no jogador e o comando nao manda a mensagem avisando para o jogador.
Se alguem puder explicar o por que disso, ficarei grato.

Ai esta o comando:
pawn Code:
CMD:slap(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    new target, slapped[MAX_PLAYER_NAME], str[128];
    if(PlayerInfo[playerid][pAdmin] != 1) return SCM(playerid, COLOR_RED, "[Aviso] Voce nao tem permissao para isso!");
    if(admworking[playerid] != 1) return SCM(playerid, COLOR_RED, "[Aviso] Voce nao esta em modo trabalho!");
    if(sscanf(params,"ui",target)) return SCM(playerid, -1, "Uso correto: /slap [playerid]");
    if(target == INVALID_PLAYER_ID) return SCM(playerid, -1, "[Aviso] Jogador Offline!");
    GetPlayerName(target, slapped, sizeof(slapped));
    format(str, sizeof(str), "[Administrador] %s deu um tapa em %s", GetName(playerid), slapped);
    GetPlayerPos(target, x, y, z);
    SetPlayerPos(target, x, y+5, z);
    ProxDetector(30.0, target, str, -1, -1, -1, -1, -1);
    return 1;
}
__________________
--------- 𝑄𝑢𝑒 𝑎 𝑡𝑒𝑚𝑝𝑒𝑠𝑡𝑎𝑑𝑒 𝑛𝑜𝑠 𝑔𝑢𝑖𝑒 𝑒𝑚 𝑚𝑒𝑢 𝑑𝑒𝑠𝑝𝑒𝑟𝑡𝑎𝑟 ---------
l3eksz is offline   Reply With Quote
Old 22/09/2019, 01:47 AM   #2
CoelhaO
Little Clucker
 
CoelhaO's Avatar
 
Join Date: Sep 2019
Location: Brasil
Posts: 15
Reputation: 0
Default Re: Comando tapa

Esta faltando
SendClientMessage

add discord CoelhaO_LokaO#4743
CoelhaO is offline   Reply With Quote
Old 22/09/2019, 01:50 AM   #3
l3eksz
Big Clucker
 
l3eksz's Avatar
 
Join Date: Nov 2018
Location: Behind you
Posts: 165
Reputation: 2
Default Re: Comando tapa

Nao sei se voce percebeu, eu estou usando ProxDetector... e o que o SCM teria haver com o comando executar ou nao?!
__________________
--------- 𝑄𝑢𝑒 𝑎 𝑡𝑒𝑚𝑝𝑒𝑠𝑡𝑎𝑑𝑒 𝑛𝑜𝑠 𝑔𝑢𝑖𝑒 𝑒𝑚 𝑚𝑒𝑢 𝑑𝑒𝑠𝑝𝑒𝑟𝑡𝑎𝑟 ---------
l3eksz is offline   Reply With Quote
Old 22/09/2019, 01:58 AM   #4
CoelhaO
Little Clucker
 
CoelhaO's Avatar
 
Join Date: Sep 2019
Location: Brasil
Posts: 15
Reputation: 0
Default Re: Comando tapa

PHP Code:
CMD:slap(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME], IDstring[120];
       if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1,"[ERRO] Voce nao e admin ou nao tem level suficiente.");
    if(
sscanf(params"u"ID)) return SendClientMessage(playerid,-1,"[USE] /slap [id]");
    if(!
IsPlayerConnected(ID))
    new 
Float:c[3];
    
GetPlayerPos(ID,c[0],c[1],c[2]);
    
SetPlayerPos(ID,c[0],c[1],c[2]+15);
    
GetPlayerName(IDnamesizeof(name));
    
format(stringsizeof(string), "%s levou um tapa."name);
    
SendClientMessageToAll(0xFFFFFFFFstring);
     return 
1;

CoelhaO is offline   Reply With Quote
Old 22/09/2019, 02:05 AM   #5
zKaioDzn
Big Clucker
 
Join Date: May 2019
Location: Inferno , q 6 r 6 Bairro 666
Posts: 77
Reputation: 0
Default Re: Comando tapa

Use este:
Desbuguei ele!

PHP Code:

CMD
:tapa(playeridparams[])
    {
            new 
playa;
            if(
sscanf(params"u"playa))
            {
                
SendClientMessageSetTime(playeridCOLOR_GRAD2"USE: /tapa [ID do Player]");
                return 
true;
            }
            new 
Float:slxFloat:slyFloat:slz;
            new 
string[128];
            if (
PlayerInfo[playerid][pAdmin] >=1)
            {
                if(
IsPlayerConnected(playa))
                {
                       if(
playa != INVALID_PLAYER_ID)
                    {
                        
GetPlayerName(playagiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
GetPlayerPos(playaslxslyslz);
                        
SetPlayerPos(playaslxslyslz+15);
                        
PlayerPlaySound(playa1190slxslyslz+12);
                        
printf("%s deu um tapa em %s",sendername,  giveplayer);
                    }
                }
            }
            else
            {
                
SendClientMessageSetTime(playeridCOLOR_GRAD1"    Voce nao pode usar este comando!");
            }
            return 
true;
    } 

+REP Pls.

Comando 100% funcional
__________________
Hey

---------------------------------------------------------


zKaioDzn is offline   Reply With Quote
Old 22/09/2019, 02:09 AM   #6
l3eksz
Big Clucker
 
l3eksz's Avatar
 
Join Date: Nov 2018
Location: Behind you
Posts: 165
Reputation: 2
Default Re: Comando tapa

Quote:
Originally Posted by zKaioDzn View Post
Use este:
Desbuguei ele!

PHP Code:

CMD
:tapa(playeridparams[])
    {
            new 
playa;
            if(
sscanf(params"u"playa))
            {
                
SendClientMessageSetTime(playeridCOLOR_GRAD2"USE: /tapa [ID do Player]");
                return 
true;
            }
            new 
Float:slxFloat:slyFloat:slz;
            new 
string[128];
            if (
PlayerInfo[playerid][pAdmin] >=1)
            {
                if(
IsPlayerConnected(playa))
                {
                       if(
playa != INVALID_PLAYER_ID)
                    {
                        
GetPlayerName(playagiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
GetPlayerPos(playaslxslyslz);
                        
SetPlayerPos(playaslxslyslz+15);
                        
PlayerPlaySound(playa1190slxslyslz+12);
                        
printf("%s deu um tapa em %s",sendername,  giveplayer);
                    }
                }
            }
            else
            {
                
SendClientMessageSetTime(playeridCOLOR_GRAD1"    Voce nao pode usar este comando!");
            }
            return 
true;
    } 

+REP Pls.

Comando 100% funcional
O que tinha de errado no meu??
__________________
--------- 𝑄𝑢𝑒 𝑎 𝑡𝑒𝑚𝑝𝑒𝑠𝑡𝑎𝑑𝑒 𝑛𝑜𝑠 𝑔𝑢𝑖𝑒 𝑒𝑚 𝑚𝑒𝑢 𝑑𝑒𝑠𝑝𝑒𝑟𝑡𝑎𝑟 ---------
l3eksz is offline   Reply With Quote
Old 22/09/2019, 02:10 AM   #7
zKaioDzn
Big Clucker
 
Join Date: May 2019
Location: Inferno , q 6 r 6 Bairro 666
Posts: 77
Reputation: 0
Default Re: Comando tapa

Quote:
Originally Posted by l3eksz View Post
O que tinha de errado no meu??
O seu ProxDetector não pode ficar abaixo de outras funções, tem que ficar abaixo do String utilizado, E ele não dá de fato um tapa!
__________________
Hey

---------------------------------------------------------


zKaioDzn is offline   Reply With Quote
Old 22/09/2019, 02:11 AM   #8
l3eksz
Big Clucker
 
l3eksz's Avatar
 
Join Date: Nov 2018
Location: Behind you
Posts: 165
Reputation: 2
Default Re: Comando tapa

tem como corrigir o meu sem modificar muita coisa?
__________________
--------- 𝑄𝑢𝑒 𝑎 𝑡𝑒𝑚𝑝𝑒𝑠𝑡𝑎𝑑𝑒 𝑛𝑜𝑠 𝑔𝑢𝑖𝑒 𝑒𝑚 𝑚𝑒𝑢 𝑑𝑒𝑠𝑝𝑒𝑟𝑡𝑎𝑟 ---------
l3eksz is offline   Reply With Quote
Old 22/09/2019, 02:12 AM   #9
zKaioDzn
Big Clucker
 
Join Date: May 2019
Location: Inferno , q 6 r 6 Bairro 666
Posts: 77
Reputation: 0
Default Re: Comando tapa

Quote:
Originally Posted by l3eksz View Post
tem como corrigir o meu sem modificar muita coisa?
Ok, em 5 minutos te mando!
__________________
Hey

---------------------------------------------------------


zKaioDzn is offline   Reply With Quote
Old 22/09/2019, 02:16 AM   #10
JamesDias
Big Clucker
 
JamesDias's Avatar
 
Join Date: Feb 2016
Posts: 50
Reputation: 4
Default Re: Comando tapa

Code:
CMD:slap(playerid, params[])
{
    new Float:x, Float:y, Float:z, target, str[128];
    if(PlayerInfo[playerid][pAdmin] != 1) return SCM(playerid, COLOR_RED, "[Aviso] Voce nao tem permissao para isso!");
    if(admworking[playerid] != 1) return SCM(playerid, COLOR_RED, "[Aviso] Voce nao esta em modo trabalho!");
    if(sscanf(params,"u",target)) return SCM(playerid, -1, "Uso correto: /slap [playerid]");
    if(target == INVALID_PLAYER_ID) return SCM(playerid, -1, "[Aviso] Jogador Offline!");
    format(str, sizeof(str), "[Administrador] %s deu um tapa em %s", GetName(playerid), GetName(target));
    GetPlayerPos(target, x, y, z);
    SetPlayerPos(target, x, y, z+10);
    SendClientMessageInRange(30.0, target, str, -1,-1,-1,-1,-1);
    return 1;
}
Não testei, veja se dá certo.

Se você não possuir a callback SendClientMessageInRange:
Code:
SendClientMessageInRange(Float:_r, playerid, _s[],c1,c2,c3,c4,c5)
{
	new Float:_x, Float:_y, Float:_z;
	GetPlayerPos(playerid, _x, _y, _z);
	foreach(Player, i)
	{
		if(!BigEar[i])
		{
		    if(GetPlayerVirtualWorld(i) != GetPlayerVirtualWorld(playerid))continue;
			if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/16)
				SendClientMessage(i, c1, _s);
			else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/8)
				SendClientMessage(i, c2, _s);
			else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/4)
				SendClientMessage(i, c3, _s);
			else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r/2)
				SendClientMessage(i, c4, _s);
			else if(GetPlayerDistanceFromPoint(i,_x,_y,_z) < _r)
				SendClientMessage(i, c5, _s);
		}
		else
		{
			SendClientMessage(i, c1, _s);
		}
	}
	return true;
}
JamesDias is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] alquem converte esse comando tapa? Weslly Stronda Português/Portuguese 9 07/02/2013 03:10 PM
[Pedido] Comando tapa em todos Players. Weslly Stronda Português/Portuguese 4 03/02/2013 04:59 PM
[Ajuda] Alquem min Min ajuda Com O comando /Tapa Weslly Stronda Português/Portuguese 8 29/11/2012 05:45 AM
[Ajuda] Comando: /Tapa Gabriel Santana Português/Portuguese 4 25/08/2012 01:46 PM
[Ajuda] Comando /tapa para Admins. Gabriel Santana Português/Portuguese 5 28/07/2012 06:37 AM


All times are GMT. The time now is 04:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.