[ajuda] Fazendo arma comum paralizar as pessoas
#1

Eu queria saber como eu faзo por exemplo os policiais tem uma pistola silenciadora ai o cara atira em uma pessoa e a pessoa atingida fica imobilizada,saca eu vi isso num sv,o comando chama /taser,o cara digia e pega a spistol ai ele atira em alguem a pessoa fica com anim de caida no chao e paralizada tem como fazer isso? se tiver me diga D:
Reply
#2

http://forum.sa-mp.com/showthread.ph...light=%2Ftaser
Reply
#3

Man esse taser ai й usado de perto eu quero um que faзa as balas das armas comuns do gta paralizarem as pessoas no sv q eu fui era a pistola silenciadora vc digitata /tazer ela vinha com 3 balas vc atirava no cara e paralizava ele
Reply
#4

forum.sa-mp.com/search.php -> Taser
Reply
#5

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(Pressed(KEY_FIRE) || Holding(KEY_FIRE) || Released(KEY_FIRE))
    {
	for(new i = 0; i < GetMaxPlayers(); i++)
	{
	    if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i))
	    {
	    	if(IsPlayerAiming(playerid, i) && GetPlayerState(i) == PLAYER_STATE_ONFOOT && GetPlayerWeapon(playerid) == 23)
		{
		    SendClientMessage(i, -1, "Vocк foi imobilizado.");
		    SendClientMessage(playerid, -1, "Vocк imobilizou o jogador.");
		    TogglePlayerControllable(i, 0);
	        }
	    }
        }
    }
    return 1;
}
- Necessбria a include Instagib para o cуdigo funcionar.
Reply
#6

Esse ai й pra quando apertar o botгo mais eu quero que sу funcione com a sdpistol (pistola silenciadora) entendeu?
Reply
#7

Sу mudar o id da arma cara --'
Reply
#8

Verifique o cуdigo.

Код:
if(IsPlayerAiming(playerid, i) && GetPlayerState(i) == PLAYER_STATE_ONFOOT && GetPlayerWeapon(playerid) == 23)
Reply
#9

em que parte do code ta o id da arma :>S
Reply
#10

https://sampwiki.blast.hk/wiki/Weapons

Code:
GetPlayerWeapon(playerid) == ID)
Reply
#11

Quote:
Originally Posted by Sonic Hero
Посмотреть сообщение
em que parte do code ta o id da arma :>S
O Cara acabou de Postar o.Х
Reply
#12

axei axei malz kk
eu queria seta sу pra policia se eu setar assim:
if(Pressed(KEY_FIRE) || Holding(KEY_FIRE) || Released(KEY_FIRE) || IsAPolice(playerid))
ele vai ficar sу pra policia nй?|
Reply
#13

Gente,onde eu coloco o code pra ser sу cops aki?
if(Pressed(KEY_FIRE) || Holding(KEY_FIRE) || Released(KEY_FIRE) || IsPlayerPolicia(playerid))

ou aki? mais se for assim eu iria trocar o npc pela policia ficando assim:
if(IsPlayerConnected(i) && playerid != i && !IsPlayerPolicia(i))
Reply
#14

O primeiro estб incorreto, vocк deveria usar &&(e) ao invйs de ou(||).

No entanto, eu sugeriria algo assim:
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(Pressed(KEY_FIRE) || Holding(KEY_FIRE) || Released(KEY_FIRE))
    {
	for(new i = 0; i < GetMaxPlayers(); i++)
	{
	    if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i) && IsAPolice(playerid))
	    {
	    	if(IsPlayerAiming(playerid, i) && GetPlayerState(i) == PLAYER_STATE_ONFOOT && GetPlayerWeapon(playerid) == 23)
		{
		    SendClientMessage(i, -1, "Vocк foi imobilizado.");
		    SendClientMessage(playerid, -1, "Vocк imobilizou o jogador.");
		    TogglePlayerControllable(i, 0);
	        }
	    }
        }
    }
    return 1;
}
Sу para policiais imobilizarem:
Code:
if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i) && IsAPolice(playerid))
Para nгo imobilizar outros policiais:
Code:
if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i) && IsAPolice(playerid) && !IsAPolice(i))
- Cuidado com o post duplo.
Reply
#15

sу 1 duvida,o meu ta return 0 qual й a diferenзa do return 0 e 1?
Reply
#16

deu esses erros aki у:
C:\Documents and Settings\Tiago\Desktop\server win32\gamemodes\gm.pwn(46305) : error 017: undefined symbol "Pressed"
C:\Documents and Settings\Tiago\Desktop\server win32\gamemodes\gm.pwn(46312) : error 017: undefined symbol "IsPlayerAiming"
Reply
#17

Neste caso, return 1: Permite que ela seja chamada em outros scripts(filterscripts...).

Isto vai no topo do gamemode junto a seus outros #defines:
pawn Code:
#define Holding(%0) ((newkeys & (%0)) == (%0))
#define Pressed(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define Released(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
Vocк precisa da include Instagib para corrigir o erro: undefined symbol "IsPlayerAiming"
ou
Adicione isto a seu script:
pawn Code:
stock IsPlayerAiming(playerid, aimid)
{
    // Luby's function.
    new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
    GetPlayerPos(playerid, X1, Y1, Z1);
    GetPlayerPos(aimid, X2, Y2, Z2);
    new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
    if(Distance < 100)
    {
        new Float:A;
        GetPlayerFacingAngle(playerid, A);
        X1 += (Distance * floatsin(-A, degrees));
        Y1 += (Distance * floatcos(-A, degrees));
        Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
        if(Distance < 0.5)
        {
            return true;
        }
    }
    return false;
}
- Evite postagens consecutivas! Edite seu ъltimo post.
Reply
#18

mesmo assim esta dando esses erros nгo sei pq se num fs ele ta normal aki ta dando erro no
"Pressed" e no "IsPlayerAiming"
Reply
#19

Vocк adicionou os #defines e a stock ou a include?

- Todos sгo em alguma parte do script acima da callback OnPlayerKeyStateChange.
Reply
#20

em qual local vai o stock em qual parte do gm?
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)