OnPlayerTakeDamge - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerTakeDamge (
/showthread.php?tid=341131)
OnPlayerTakeDamge -
[D]ry[D]esert - 09.05.2012
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.
Re: OnPlayerTakeDamge -
Revo - 09.05.2012
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.
Re: OnPlayerTakeDamge -
ViniBorn - 09.05.2012
pawn Код:
GameTextForPlayer(playerid,string,1000,3);
Re: OnPlayerTakeDamge -
rati555 - 09.05.2012
playerid is missing
Re: OnPlayerTakeDamge -
HDFord - 09.05.2012
Edit

orry. Use "playerid" instead of "victim"
Re: OnPlayerTakeDamge -
ViniBorn - 09.05.2012
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...
Re: OnPlayerTakeDamge -
HDFord - 09.05.2012
I did not think see my edit. Sometimes i just....-.-.........when i'm trying to do things fast.
Re: OnPlayerTakeDamge -
[D]ry[D]esert - 09.05.2012
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
Re: OnPlayerTakeDamge -
[D]ry[D]esert - 09.05.2012
Thank you all,all + rep -.- , XD