[Ajuda] Sistema de Taser
#1

Bom o sistema nгo й meu , sу dei uma procurada no ****** e achei , porйm o sistema estб bugado , tipo eu tou com a arma de taser que no caso й a sniper e se eu acertar alguйm eu e a vнtima fica paralisada , e eu nгo conseguir resolver quero que sу a vнtima fique paralizada por 10 segundos e que sу a sniper dos cops seja taser .

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#pragma tabsize 0


//|________________ Configuraзгo ________________|

#define Taser_Time 5000
#define WEAPON 34
#define R_SOUND 50.0
#define WHITE -1
#define YELLOW 0xFFFF00AA

// |______________________________________________|

new ContinueTaser[MAX_PLAYERS];

forward GetClosestPlayer(p1);
forward Float:GetDistanceBetweenPlayers(p1,p2);


public OnPlayerConnect(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new victimid = GetClosestPlayer(playerid);
        if(IsPlayerConnected(victimid))
        {
            if(ContinueTaser[playerid] == 1)
            {
                TogglePlayerControllable(playerid, 0);
                TogglePlayerControllable(victimid, 0);
                ContinueTaser[playerid] = 1;
                SendClientMessage(playerid, WHITE, "Voce usou seu {FFCC33}taser!");
                SendClientMessage(playerid, YELLOW, "Voce pode continuar usando TASER para manter a eletrecidade.");
                SendClientMessage(victimid, WHITE, "Voce recebeu um dardo de {FFCC33}taser!");
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                SetTimerEx("TaserTime", Taser_Time, 0, "d", victimid);
                SetTimerEx("StopTaser", Taser_Time, 0, "d", playerid);
            }
        }
        return 1;
    }
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:Chaleco, Float:Vida;
        GetPlayerArmour(playerid, Chaleco);
        GetPlayerHealth(playerid, Vida);
        if(weaponid == WEAPON)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                return 1;
            }

            GameTextForPlayer(playerid, "~r~Paralizado pelo TASER", Taser_Time, 5);
            TogglePlayerControllable(playerid, 0);
            TogglePlayerControllable(issuerid, 0);
            ContinueTaser[issuerid] = 1;
            new Float:Audio_X, Float:Audio_Y, Float:Audio_Z;
            GetPlayerPos(playerid, Audio_X, Audio_Y, Audio_Z);
            StopAudioStreamForPlayer(playerid);
            PlayAudioStreamForPlayer(playerid, "http://k004.kiwi6.com/hotlink/9s19772cbe/taser_sound.mp3", Audio_X, Audio_Y, Audio_Z, R_SOUND, 1);
            SendClientMessage(issuerid, WHITE, "Voce usou seu {FFCC33}taser{FFFFFF}!");
            SendClientMessage(issuerid, YELLOW, "Vocк pode continuar a disparar o taser ea vнtima vai voltar a receber energia elйtrica.");
            SendClientMessage(playerid, WHITE, "Voce recebeu um dardo de {FFCC33}taser{FFFFFF}!");
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            SetTimerEx("TaserTime", Taser_Time, 0, "d", playerid);
            SetTimerEx("StopTaser", Taser_Time, 0, "d", issuerid);
        }
    }
    return 1;
}

forward TaserTime(playerid);
public TaserTime(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    return 1;
}

forward StopTaser(playerid);
public StopTaser(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    ContinueTaser[playerid] = 0;
    return 1;
}

public GetClosestPlayer(p1)
{
    new x,Float:dis,Float:dis2,player2;
    player2 = -1;
    dis = 99999.99;
    for (x=0;x<MAX_PLAYERS;x++)
    {
        if(IsPlayerConnected(x))
        {
            if(x != p1)
            {
                dis2 = GetDistanceBetweenPlayers(x,p1);
                if(dis2 < dis && dis2 != -1.00)
                {
                    dis = dis2;
                    player2 = x;
                }
            }
        }
    }
    return player2;
}

public Float:GetDistanceBetweenPlayers(p1,p2)
{
   new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
   if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
   {
      return -1.00;
   }
   GetPlayerPos(p1,x1,y1,z1);
   GetPlayerPos(p2,x2,y2,z2);
   return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Reply
#2

Retire
pawn Код:
TogglePlayerControllable(playerid, 0);
Reply
#3

igual o cara falo acima /\

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#pragma tabsize 0


//|________________ Configuraзгo ________________|

#define Taser_Time 5000
#define WEAPON 34
#define R_SOUND 50.0
#define WHITE -1
#define YELLOW 0xFFFF00AA

// |______________________________________________|

new ContinueTaser[MAX_PLAYERS];

forward GetClosestPlayer(p1);
forward Float:GetDistanceBetweenPlayers(p1,p2);


public OnPlayerConnect(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new victimid = GetClosestPlayer(playerid);
        if(IsPlayerConnected(victimid))
        {
            if(ContinueTaser[playerid] == 1)
            {
                TogglePlayerControllable(playerid, 0);
                TogglePlayerControllable(victimid, 0);
                ContinueTaser[playerid] = 1;
                SendClientMessage(playerid, WHITE, "Voce usou seu {FFCC33}taser!");
                SendClientMessage(playerid, YELLOW, "Voce pode continuar usando TASER para manter a eletrecidade.");
                SendClientMessage(victimid, WHITE, "Voce recebeu um dardo de {FFCC33}taser!");
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                SetTimerEx("TaserTime", Taser_Time, 0, "d", victimid);
                SetTimerEx("StopTaser", Taser_Time, 0, "d", playerid);
            }
        }
        return 1;
    }
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:Chaleco, Float:Vida;
        GetPlayerArmour(playerid, Chaleco);
        GetPlayerHealth(playerid, Vida);
        if(weaponid == WEAPON)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                return 1;
            }

            GameTextForPlayer(playerid, "~r~Paralizado pelo TASER", Taser_Time, 5);
            TogglePlayerControllable(playerid, 0);
            TogglePlayerControllable(issuerid, 0);
            ContinueTaser[issuerid] = 1;
            new Float:Audio_X, Float:Audio_Y, Float:Audio_Z;
            GetPlayerPos(playerid, Audio_X, Audio_Y, Audio_Z);
            StopAudioStreamForPlayer(playerid);
            PlayAudioStreamForPlayer(playerid, "http://k004.kiwi6.com/hotlink/9s19772cbe/taser_sound.mp3", Audio_X, Audio_Y, Audio_Z, R_SOUND, 1);
            SendClientMessage(issuerid, WHITE, "Voce usou seu {FFCC33}taser{FFFFFF}!");
            SendClientMessage(issuerid, YELLOW, "Vocк pode continuar a disparar o taser ea vнtima vai voltar a receber energia elйtrica.");
            SendClientMessage(playerid, WHITE, "Voce recebeu um dardo de {FFCC33}taser{FFFFFF}!");
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            SetTimerEx("TaserTime", Taser_Time, 0, "d", playerid);
            SetTimerEx("StopTaser", Taser_Time, 0, "d", issuerid);
        }
    }
    return 1;
}

forward TaserTime(playerid);
public TaserTime(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    return 1;
}

forward StopTaser(playerid);
public StopTaser(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    ContinueTaser[playerid] = 0;
    return 1;
}

public GetClosestPlayer(p1)
{
    new x,Float:dis,Float:dis2,player2;
    player2 = -1;
    dis = 99999.99;
    for (x=0;x<MAX_PLAYERS;x++)
    {
        if(IsPlayerConnected(x))
        {
            if(x != p1)
            {
                dis2 = GetDistanceBetweenPlayers(x,p1);
                if(dis2 < dis && dis2 != -1.00)
                {
                    dis = dis2;
                    player2 = x;
                }
            }
        }
    }
    return player2;
}

public Float:GetDistanceBetweenPlayers(p1,p2)
{
   new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
   if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
   {
      return -1.00;
   }
   GetPlayerPos(p1,x1,y1,z1);
   GetPlayerPos(p2,x2,y2,z2);
   return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Reply
#4

Quote:
Originally Posted by iSmir
Посмотреть сообщение
igual o cara falo acima /\

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#pragma tabsize 0


//|________________ Configuraзгo ________________|

#define Taser_Time 5000
#define WEAPON 34
#define R_SOUND 50.0
#define WHITE -1
#define YELLOW 0xFFFF00AA

// |______________________________________________|

new ContinueTaser[MAX_PLAYERS];

forward GetClosestPlayer(p1);
forward Float:GetDistanceBetweenPlayers(p1,p2);


public OnPlayerConnect(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    ContinueTaser[playerid] = 0;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        new victimid = GetClosestPlayer(playerid);
        if(IsPlayerConnected(victimid))
        {
            if(ContinueTaser[playerid] == 1)
            {
                TogglePlayerControllable(playerid, 0);
                TogglePlayerControllable(victimid, 0);
                ContinueTaser[playerid] = 1;
                SendClientMessage(playerid, WHITE, "Voce usou seu {FFCC33}taser!");
                SendClientMessage(playerid, YELLOW, "Voce pode continuar usando TASER para manter a eletrecidade.");
                SendClientMessage(victimid, WHITE, "Voce recebeu um dardo de {FFCC33}taser!");
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                ApplyAnimation(victimid,"PED","KO_skid_front",4.1,0,1,1,1,0);
                SetTimerEx("TaserTime", Taser_Time, 0, "d", victimid);
                SetTimerEx("StopTaser", Taser_Time, 0, "d", playerid);
            }
        }
        return 1;
    }
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:Chaleco, Float:Vida;
        GetPlayerArmour(playerid, Chaleco);
        GetPlayerHealth(playerid, Vida);
        if(weaponid == WEAPON)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                return 1;
            }

            GameTextForPlayer(playerid, "~r~Paralizado pelo TASER", Taser_Time, 5);
            TogglePlayerControllable(playerid, 0);
            TogglePlayerControllable(issuerid, 0);
            ContinueTaser[issuerid] = 1;
            new Float:Audio_X, Float:Audio_Y, Float:Audio_Z;
            GetPlayerPos(playerid, Audio_X, Audio_Y, Audio_Z);
            StopAudioStreamForPlayer(playerid);
            PlayAudioStreamForPlayer(playerid, "http://k004.kiwi6.com/hotlink/9s19772cbe/taser_sound.mp3", Audio_X, Audio_Y, Audio_Z, R_SOUND, 1);
            SendClientMessage(issuerid, WHITE, "Voce usou seu {FFCC33}taser{FFFFFF}!");
            SendClientMessage(issuerid, YELLOW, "Vocк pode continuar a disparar o taser ea vнtima vai voltar a receber energia elйtrica.");
            SendClientMessage(playerid, WHITE, "Voce recebeu um dardo de {FFCC33}taser{FFFFFF}!");
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
            SetTimerEx("TaserTime", Taser_Time, 0, "d", playerid);
            SetTimerEx("StopTaser", Taser_Time, 0, "d", issuerid);
        }
    }
    return 1;
}

forward TaserTime(playerid);
public TaserTime(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    return 1;
}

forward StopTaser(playerid);
public StopTaser(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid);
    ContinueTaser[playerid] = 0;
    return 1;
}

public GetClosestPlayer(p1)
{
    new x,Float:dis,Float:dis2,player2;
    player2 = -1;
    dis = 99999.99;
    for (x=0;x<MAX_PLAYERS;x++)
    {
        if(IsPlayerConnected(x))
        {
            if(x != p1)
            {
                dis2 = GetDistanceBetweenPlayers(x,p1);
                if(dis2 < dis && dis2 != -1.00)
                {
                    dis = dis2;
                    player2 = x;
                }
            }
        }
    }
    return player2;
}

public Float:GetDistanceBetweenPlayers(p1,p2)
{
   new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
   if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
   {
      return -1.00;
   }
   GetPlayerPos(p1,x1,y1,z1);
   GetPlayerPos(p2,x2,y2,z2);
   return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Mas vocк nгo retirou o TogglePlayerControllable em playerid
Reply
#5

Vlw galera muito obrigado , + rep pra vocкs !

Agora como faзo pra sу as snipers dos cop's usar o taser ?
Reply
#6

pawn Код:
#define WEAPON 34 // Mude o 34 para o ID da sniper.
Reply
#7

Quote:
Originally Posted by Dwayne-Pheonix
Посмотреть сообщение
Mas vocк nгo retirou o TogglePlayerControllable em playerid
kkkkkkkk
caraii eskeci

eu tinha copiado o code dele, e editei no notepad mais nem passei o code certo pra ka. ¬¬''
Reply
#8

Quote:
Originally Posted by matheus_alcapone
Посмотреть сообщение
pawn Код:
#define WEAPON 34 // Mude o 34 para o ID da sniper.
Vocк nгo entendeu , com esse code qualquer um que estiver sniper poderб dar o taser , e eu quero que sу as snipers dos cop's atire , como faзo pra definir ?
Reply
#9

Abaixo de:

pawn Код:
if(newkeys & KEY_FIRE)
    {
Verifique a variбvel do jogador que corresponde a ele ser um "COP".

Exemplo:
pawn Код:
if(newkeys & KEY_FIRE) {
    if(variavel == valorcop) {
Reply
#10

Jб tinha conseguido , mesmo assim + rep pra tu tbm !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)