Specification
#1

I want the system to specify between a gun shoot and a fists hit.


I want to create a system. wounded system that when you get shot you applyanimation and so on. so the problem is when someone hit someone with fists he applyanimation. so I want the server to specify between a gun shoot and fists hit.



Hope you understand me.
Reply
#2

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid != 0) // Meaning: "if NOT fists" Weapon ID 0 is Fist
    {
        // YOUR CODE (ApplyAnimation etc.)
    }
    return 1;
}
Reply
#3

Actually I want when the player's hp hit the 10-5 the player applyanmation, and that's only if he got a shot with a gun.
Reply
#4

And I'm having another problem. when I do.


Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid != 0) // Meaning: "if NOT fists" Weapon ID 0 is Fist
    {
        VariableX[playerid] = true;
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
           if VariableX[playerid] = true
               return SendClientMessage(playerid, ..., "You're wounded!");

{
And the problem is the server spamming me.
Reply
#5

Instead of
public OnPlayerUpdate
{
if VariableX[playerid] = true
return SendClientMessage(playerid, ..., "You're wounded!");

{

use

public OnPlayerUpdate
{
if(VariableX[playerid] == true)
{
SendClientMessage(playerid, ..., "You're wounded!");
VeriableX[playerid] = false;
}

{
Reply
#6

I'm thinking about to add a system like this..


Код:
SendClientMessage(playerid, C, "You're wounded, /killme to acceptdeath");


CMD:killme..
{
      if(VariableX[playerid] == true)
      {
           SetPlayerHealth(playerid, 0);
           VeriableX[playerid] = false;
      {
      else
      {  
           SendClientMessage(playerid, C, "You're not wounded");
      {
So the code that you gave me. will ruin everything.
Reply
#7

So the whole plan is. when player hit another with a gun and the health hit the 10-5. the variableX(wounded) sets to 1 or true.

And after that the server will send a message to the player that hit the 10-5 or have the variableX true "You're wounded so use /killme to acceptdeath" and a applyanimation and so on.

Aand the command /killme without a check if the player have the VariableX true or false.



Simply.
Reply
#8

No one can helpme to create that system and to prevent suchs bugs


(Spamming player when he hit the 10-5 hp or get the variableX enabled) and a /killme without a detection if the player have the variableX enabled simply?
Reply
#9

There's no bug. It does exactly what you're telling it too, OnPlayerUpdate is called once every 40ms or so, which means ALOT. Which is why you're being spammed.
It will slow down your server so I would recommend not to use it.

By the way, you don't need it, OnPlayerTakeDamage is called every time you get hurt so that is the only callback you need for this.
Reply
#10

I wanted to take it from the easy way.

Код:
OnPlayerTakeDamage(playerid)
{
       VeriableX[playerid] = true;
{


OnPlayerUpdate(playerid)
{ 
     if VeriableX[playerid] = True;
     { 
             ApplyAnimation and so on..
So give me a example...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)