OnPlayerTakeDamage doesn't work
#1

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;

Reply
#2

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

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);
Reply
#4

Should work, try to compile
Reply
#5

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

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

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

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
Reply
#8

Is your a_samp include up to date?
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)