Regarding taser system.
#1

resolved!
Reply
#2

Still seeking for help
Reply
#3

this is all you need

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
Reply
#4

I have another way to do it which is completely different method in fact you wouldn't need any commands but would have to accept a limitations. Anyways I've done a lot of work lately using some simple collision techniques. The only problem is it's possible to shoot through objects or walls but I would think you'd have to get pretty lucky to abuse it. Anyways with that said you could use a melee weapon as the taser and some other stuff just a suggestion. Otherwise OnPlayerTakeDamage() or OnPlayerGiveDamage() will work if you want to take that route.
Reply
#5

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
I have another way to do it which is completely different method in fact you wouldn't need any commands but would have to accept a limitations. Anyways I've done a lot of work lately using some simple collision techniques. The only problem is it's possible to shoot through objects or walls but I would think you'd have to get pretty lucky to abuse it. Anyways with that said you could use a melee weapon as the taser and some other stuff just a suggestion. Otherwise OnPlayerTakeDamage() or OnPlayerGiveDamage() will work if you want to take that route.
I don't really like using OnPlayerShootPlayer "OPSP", I'd rather choose different way.

And I am not really as of now looking to use meele type taser system, there are tons tut of those in ******.

I am looking for something like.

> Only cop would be able to do /taser - This would give them sd pistol with taser loaded already without any commands.
> Once you hit someone with taser We togglePlayerControllable(playerid,0), Then we SetTimerEx for around 20 seconds and SendClientMessage saying "You've been tazed by %s and is unable to move".
> Then after 20 seconds TogglePlayerControllable(playerid,1) -> That is how I wanted it.

if anyone could show me an example, I'd really appreciate it
Reply
#6

OnPlayerTakeDamage() or OnPlayerGiveDamage() then
Reply
#7

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(weaponid == 23) //silenced pistol
    {
        if(IsCop[issuerid] == 1]) //if the shooter is cop
        {
            new string[128], pName[MAX_PLAYERS_NAME];
            GetPlayerName(issuerid, pName, sizeof(pName);
            format(string, sizeof(string), "You've been tazed by %s and you are unable to move", pName);
            SendCliendMessage(playerid, -1, string); //lettin him know who tazed him
           
            TogglePlayerControllable(playerid, 0); //freeze player
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 20000, 0); //we set the animation for 20 seconds
            SetTimerEx("Unfreeze", 20000, false, "i", playerid); //timer to unfreeze player in 20 seconds
        }
    }
    return 1;
}

forward Unfreeze(playerid);
public Unfreeze(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
A quick try that I made, haven't tested but that's an idea on how to create it.
Reply
#8

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(weaponid == 23) //silenced pistol
    {
        if(IsCop[issuerid] == 1]) //if the shooter is cop
        {
            new string[128], pName[MAX_PLAYERS_NAME];
            GetPlayerName(issuerid, pName, sizeof(pName);
            format(string, sizeof(string), "You've been tazed by %s and you are unable to move", pName);
            SendCliendMessage(playerid, -1, string); //lettin him know who tazed him
           
            TogglePlayerControllable(playerid, 0); //freeze player
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 20000, 0); //we set the animation for 20 seconds
            SetTimerEx("Unfreeze", 20000, false, "i", playerid); //timer to unfreeze player in 20 seconds
        }
    }
    return 1;
}

forward Unfreeze(playerid);
public Unfreeze(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
A quick try that I made, haven't tested but that's an idea on how to create it.
Thank you!
Reply
#9

Quote:
Originally Posted by DavidLuango
Посмотреть сообщение
That doesn't contain the command /taser -> How do I make that in this concept?
It doesn't need the command /taser. It runs the code if the cop shoots a person with weapon ID 23.
Reply
#10

Resolved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)