SA-MP Forums Archive
OnPlayerTakeDamage doesn't work - 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: OnPlayerTakeDamage doesn't work (/showthread.php?tid=604372)



OnPlayerTakeDamage doesn't work - NeXoR - 03.04.2016

As stated in previous threads I tried to return the cmd "dropgun" when a player takes damage (I didn't add bodypart for debugging)

Error shows up > Undefined symbol - Params

I know that it doesn't work because there isn't any params in the callback
So anyone knows how to fix it ? (Pretty new to experienced scripting)
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    new 
string[128];
    
format(string,sizeof(string),"-%.0f HP",amount);
    
SetPlayerChatBubble(playerid,string,0x660000AA,150.0,2500);
    if(!
IsPlayerInAnyVehicle(playerid) && IsPlayerLoggedIn(playerid))
    {
        return 
cmd_dropgun(playeridparams);
    }
    return 
1;




Re: OnPlayerTakeDamage doesn't work - Jefff - 03.04.2016

You can set any text or \1
pawn Код:
return cmd_dropgun(playerid, "blabla");
pawn Код:
return cmd_dropgun(playerid, "\1");



Re: OnPlayerTakeDamage doesn't work - NeXoR - 03.04.2016

Quote:
Originally Posted by Jefff
Посмотреть сообщение
You can set any text or \1
pawn Код:
return cmd_dropgun(playerid, "blabla");
pawn Код:
return cmd_dropgun(playerid, "\1");
Can I simply return without params ?
I mean (playerid);


Re: OnPlayerTakeDamage doesn't work - Jefff - 03.04.2016

Should work, try to compile


Re: OnPlayerTakeDamage doesn't work - NeXoR - 03.04.2016

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Should work, try to compile
Show's up a warning
I can try to send "" = (playerid, "");


Re: OnPlayerTakeDamage doesn't work - AndySedeyn - 03.04.2016

Declare the command without the 'params' parameter:
PHP код:
CMD:dropgun(playerid) {
    return 
true;

And then use it like so:
PHP код:
return cmd_dropgun(playerid); 



Re: OnPlayerTakeDamage doesn't work - NeXoR - 03.04.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
Declare the command without the 'params' parameter:
PHP код:
CMD:dropgun(playerid) {
    return 
true;

And then use it like so:
PHP код:
return cmd_dropgun(playerid); 
works
BTW, the callback shows an error on my script
PHP код:
D:\samp037_svr_R2-1-1_win32\gamemodes\UGRP.pwn(7621) : error 025: function heading differs from prototype 
All I did was adding "bodypart" to the end
Current:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart
Previous:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid



Re: OnPlayerTakeDamage doesn't work - AndySedeyn - 03.04.2016

Is your a_samp include up to date?


Re: OnPlayerTakeDamage doesn't work - NeXoR - 03.04.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
Is your a_samp include up to date?
Should be, I redownloaded it today to update PoolSize, I'll update it once again to validate

EDIT - Yes its updated


Re: OnPlayerTakeDamage doesn't work - AndySedeyn - 03.04.2016

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
Should be, I redownloaded it today to update PoolSize, I'll update it once again to validate
Are you using an old version of YSI? If so, check this out: https://sampforum.blast.hk/showthread.php?tid=488198