OnPlayerTakeDamge
#1

Whats wrong with this
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
        new weaponname[24];
        GetPlayerName(playerid, victim, sizeof (victim));
        GetPlayerName(issuerid, attacker, sizeof (attacker));

        GetWeaponName(weaponid, weaponname, sizeof (weaponname));
        format(string, sizeof(string), " %.0f",amount);
line 274  >> GameTextForPlayer(victim,string,1000,3);
    }
    return 1;
}
Error Show
Код:
C:\Users\almooo\Desktop\Zombe server test\gamemodes\Zm.pwn(274) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

You're getting the name of the victim.

GameTextForPlayer uses the playerid.


E.G: Revo(1)[issuer] shoots Zombie(2)[victim], the gametextforplayer syntax would be
pawn Код:
GameTextForPlayer(playerid, "You took damage", 5000, 3);
Issuerid is the one shooting you, and seeing as you want to display it for the victim, playerid is exactly what you need.
Reply
#3

pawn Код:
GameTextForPlayer(playerid,string,1000,3);
Reply
#4

playerid is missing
Reply
#5

Editorry. Use "playerid" instead of "victim"
Reply
#6

Quote:
Originally Posted by HDFord
Посмотреть сообщение
It's not possible to use something else then "playerid" on GameTextForPlayer easy as that change it to SendClientMessage
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
        new weaponname[24];
        GetPlayerName(playerid, victim, sizeof (victim));
        GetPlayerName(issuerid, attacker, sizeof (attacker));
        GetWeaponName(weaponid, weaponname, sizeof (weaponname));
        format(string, sizeof(string), " %.0f",amount);
        SendClientMessage(victim,0xFFFFFFFF,string);
    }
    return 1;
}
You can't use 'victim' in SendClientMessage. 'victim' isn't an integer...
Reply
#7

I did not think see my edit. Sometimes i just....-.-.........when i'm trying to do things fast.
Reply
#8

Quote:
Originally Posted by BuuGhost
Посмотреть сообщение
You're getting the name of the victim.

GameTextForPlayer uses the playerid.


E.G: Revo(1)[issuer] shoots Zombie(2)[victim], the gametextforplayer syntax would be
pawn Код:
GameTextForPlayer(playerid, "You took damage", 5000, 3);
Issuerid is the one shooting you, and seeing as you want to display it for the victim, playerid is exactly what you need.
Thanks Work + Rep
Reply
#9

Thank you all,all + rep -.- , XD
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)