[Help] /slap Help
#1

Aii to precisando fazer tipo um /slap que teleporte o Player atй um Local e Exploda ele, se nгo Perder HP aparece para os admins que ele nгo perdeu HP, caso Perca HP volta ao Mesmo local que tomou o /slap com o mesmo HP que jб estava.
Tipo o do Advanced A/D 1.3

procurei como fazer em todos os Lugares, nгo consegui,

sou Muito iniciante nisso, dб um Help aii
Reply
#2

pawn Код:
if(strcmp("/slap", cmdtext, true) == 0)
{
     new Float:X, Float:Y, Float:Z;
     GetPlayerPos(playerid, X, Y, Z);
     new Float:Vida = GetPlayerHealth(playerid, Vida);
     SetPlayerPos(playerid, 0.0, 0.0, 0.0); // Mude aqui para as cordenadas que deseja setar o jogador
     if(GetPlayerHealth(playerid) == Vida))
     {
           for(new i = 0; i < GetMaxPlayers(); i++)
           {
                 if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
                 {
                      format(string, sizeof(string), "O player %s levou um slasp e nгo perdeu life", playerB(playerid));
                      SendClientMessage(i, -1, string);
                 }
            }
            return 1;
     }
     else
     {
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerHealth(playerid, Vida);
            SendClientMessage(playerid, -1, "Vocк foi acusado de life hack e perdeu life!");
            SendClientMessage(playerid, 0xAFFFFFFA, "Com isso foi inocentado.");
            return 1;
     }
     return 1;
}
Tenta ai =).
Reply
#3

Shickcard, lб quando vocк fez:

pawn Код:
new Float:Vida = GetPlayerHealth(playerid, Vida);
O certo й:

pawn Код:
new Float:Vida;
GetPlayerHealth(playerid, Vida);
E depois no:

pawn Код:
if(GetPlayerHealth(playerid) == Vida))
O certo seria:

pawn Код:
if(Vida == Vida)
Apesar de estar comparando duas coisas iguais, й o que teria acontecido se a funзгo GetPlayerHealth funcionasse como vocк postou
Reply
#4

Obrigado Acer. Ultimamente estou com muita falta de atenзгo :S
Reply
#5

Esqueceu do CreateExplosion
Reply
#6

Quote:
Originally Posted by Shickcard
Посмотреть сообщение
pawn Код:
if(strcmp("/slap", cmdtext, true) == 0)
{
     new Float:X, Float:Y, Float:Z;
     GetPlayerPos(playerid, X, Y, Z);
     new Float:Vida = GetPlayerHealth(playerid, Vida);
     SetPlayerPos(playerid, 0.0, 0.0, 0.0); // Mude aqui para as cordenadas que deseja setar o jogador
     if(GetPlayerHealth(playerid) == Vida))
     {
           for(new i = 0; i < GetMaxPlayers(); i++)
           {
                 if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
                 {
                      format(string, sizeof(string), "O player %s levou um slasp e nгo perdeu life", playerB(playerid));
                      SendClientMessage(i, -1, string);
                 }
            }
            return 1;
     }
     else
     {
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerHealth(playerid, Vida);
            SendClientMessage(playerid, -1, "Vocк foi acusado de life hack e perdeu life!");
            SendClientMessage(playerid, 0xAFFFFFFA, "Com isso foi inocentado.");
            return 1;
     }
     return 1;
}
Tenta ai =).
E mesmo assim, quando vocк coloca o jogador na coordenada Z 1200, a vida dele continua a mesma e sу diminui quando chega ao chгo.

Estou criando um codigo aqui, se eu nгo postar hoje, amanha eu posto.
Reply
#7

olha champz ve se funfa

no topu
Код:
new Float:vida;
new Float:colete;
new Float:slx, Float:sly, Float:slz;
no onplayercomm

Код:
if(strcmp(cmd, "/slap", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "[USO CORRETO]: /slap [playerid/PartOfName]");
				return 1;
			}
			new idjogador;
			idjogador = ReturnUser(tmp);
			if(IsPlayerAdmin(playerid))
			{
			    if(IsPlayerConnected(idjogador))
			    {
			        if(idjogador != INVALID_PLAYER_ID)
			        {
						GetPlayerPos(idjogador, slx, sly, slz);
						GetPlayerHealth(idjogador,vida);
						GetPlayerArmour(idjogador,colete);
					    SetPlayerPos(idjogador, 1133.0504,-2038.4034,69.0971);
                        CreateExplosion(1133.0504,-2038.4034,69.0971, 7, 1);
						SetTimerEx("TestarGod",2000, false, "i", idjogador);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "Apenas Administradores!");
			}
		}
		return 1;
	}
Код:
forward TestarGod(playerid);
public TestarGod(playerid)
{
	new Float:checkvida,Float:checkcolete;
	GetPlayerHealth(playerid, checkvida);
	GetPlayerArmour(playerid, checkcolete);
    if(checkvida > 99)
    {
        SendClientMessageToAll(COLOR_GREY, "O jogador estб com health hack");
    }
    else if(checkvida < 99)
    {
        SendClientMessageToAll(COLOR_GREY, "O jogador perdeu hp normalmente");
    }
    if(checkcolete > 99)
    {
        SendClientMessageToAll(COLOR_GREY, "O jogador estб com armour hack");
    }
    else if(checkcolete < 99)
    {
        SendClientMessageToAll(COLOR_GREY, "O jogador perdeu colete normalmente");
    }
    SetPlayerHealth(playerid, vida);
    SetPlayerArmour(playerid, colete);
    SetPlayerPos(playerid, slx, sly, slz);
	return 1;
}
OBS: Nгo testei pode nгo funcionar^^
Reply
#8

No topo aн й que nгo vai funcionar, tens que colocar dentro da OnPlayerCommandText. O topo й usado para variбveis globais, principalmente.
Reply
#9

Testei e funcionou:

PHP код:
new timer[MAX_PLAYERS] = -1;
new 
ID[MAX_PLAYERS];

public 
OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[256], idx;
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/slap"true) == 0)
    {
        new 
s[256], Float:P[5], intid;
        
strtok(cmdtextidx);
        if(!
strlen(s)) return SendClientMessage(playerid, -1"USO: /slap [ID]");
        
id strval(s);
        if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xFF0000FF"Jogador OFFLINE.");
        if(
timer[id] != -1) return SendClientMessage(playerid0xFF0000FF"Este jogador jб estб sendo testado.");
        
GetPlayerPos(idP[0], P[1], P[2]);
        
int GetPlayerInterior(playerid);
        
GetPlayerHealth(idP[3]);
        
GetPlayerFacingAngle(idP[4]);
        
SetPlayerPos(playerid1678.9671447.949150);
        
CreateExplosion(1678.9671447.949145102000);
        
SetPlayerInterior(playerid0);
        
ID[id] = playerid;
        
timer[playerid] = SetTimerEx("Check"10000false"ddfffffd"playerididP[0], P[1], P[2], P[3], P[4], int);
        
SendClientMessage(playerid0xFFFF00FF"Aguarde 10 segundos para checar se este jogador estб usando cheat.");
        
printf("DEBUG 1 - [id %d]: %f"idP[3]);
        
        return 
1;
    }
    return 
0;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
timer[playerid] != -1)
    {
        
KillTimer(timer[playerid]);
        
timer[playerid] = -1;
        
SendClientMessage(ID[playerid], 0xFFFF00FF"O jogador nгo estб usando cheat.");
        
ID[playerid] = -1;
    }
    return 
1;
}

forward Check(playeridpIDFloat:XFloat:YFloat:ZFloat:AngleFloat:Healthinterior);

public 
Check(playeridpIDFloat:XFloat:YFloat:ZFloat:AngleFloat:Healthinterior)
{
    new 
str[128];
    if(!
IsPlayerConnected(pID)) return SendClientMessage(playerid0xFF0000FF"O jogador desconectou.");
    new 
Float:P;
    
GetPlayerHealth(pIDP);
    
printf("DEBUG 2 - [id %d]: %f"pIDP);
    if(
floatcmp(PHealth) != 0) { SendClientMessage(playerid0xFFFF00FF"O jogador nгo estб usando cheat."); }
    else
    {
        
GetPlayerName(pIDstr24);
        
format(strsizeof str"O jogador %s [ID %d] pode estar usando cheat !"strpID);
        for(new 
0GetMaxPlayers(); i++)
        {
            if(!
IsPlayerAdmin(i)) continue;
            
SendClientMessage(i0xDE0AFFFFstr);
        }
    }
    
SetPlayerHealth(pIDHealth);
    
SetPlayerPos(pIDXYZ);
    
SetPlayerInterior(pIDinterior);
    
SetPlayerFacingAngle(pIDAngle);
    
SetCameraBehindPlayer(pID);
    
ID[playerid] = -1;
    
timer[playerid] = -1;
    return 
1;
}

// CASO NГO TENHA, ADICIONE AO SEU GM:

strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }

    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

OBS: Aconselho a colocar no servidor como FilterScript ou vocк poderб causar muitos erros, caso seja novato.
Reply
#10

Vai dar fail, ele precisa sincronizar o interior+posiзгo (posiзгo se o jogador estiver muito longe) teria que mandar o jogador para a posiзгo e depois de 500 MS ou 700 criar a explosгo caso o contrбrio ele vai ser reprovado (em algums casos), mas nгo por estar de god e sim por nгo estar sincronizado. Acredite.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)