[Include] weapon-config.inc - Damage system with many features

Quote:
Originally Posted by Slice
Посмотреть сообщение
[*]Different animation depending on weapon/bodypart, for example:
  • Headshots make you fall back with both hands in your face
  • Shotgun kills make you fly backward like in GTA:VC (unless killed from behind)
And how exactly do we do that?
I'm sorry, i'm a total noob and seeing this huge wall of code isn't that encouraging...
Reply

Quote:
Originally Posted by Greggu
Посмотреть сообщение
And how exactly do we do that?
I'm sorry, i'm a total noob and seeing this huge wall of code isn't that encouraging...
It is enabled by default.
Reply

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
It is enabled by default.
I just tested it on my server and when it kills someone it will just display the default animation.
Do i have to compile something in the include as a filterscript?
Reply

Did you install SKY?

Post your server log.
Reply

Quote:
Originally Posted by Slice
Посмотреть сообщение
Did you install SKY?

Post your server log.
Well i put SKY in my server's "plugins" folder...
Also, i'm not sure why the include tab won't display anything under weapon-config.



Anyway, i didn't really do anything with the include yet. I just put it in my includes folder, and since the other guy said it's on by default i just left it there. Do i have to make a filterscript with it?
Reply

Quote:
Originally Posted by Greggu
Посмотреть сообщение
Well i put SKY in my server's "plugins" folder...
Also, i'm not sure why the include tab won't display anything under weapon-config.



Anyway, i didn't really do anything with the include yet. I just put it in my includes folder, and since the other guy said it's on by default i just left it there. Do i have to make a filterscript with it?
No, you include the include in your gamemode.
Reply

Quote:
Originally Posted by Slice
Посмотреть сообщение
Try removing some plugins (nativechecker, itd, geoip) to see if they are interfering with SKY.

Did you compile SKY yourself or download it?
I think the nativechecker causes these errors. The problem with the damage was in my script.
Reply

Quote:
Originally Posted by SecretBoss
View Post
What plugins are required to use this include? Because I compiled my script and it printed gamemode as Unknown
Only SKY plugin.
Reply

How can i customize death atnimations? I tryed to play an animation for a player under OnPlayerPrepareToDeath but it doesn't work.
Reply

Quote:
Originally Posted by ExTaZZ69
View Post
How can i customize death atnimations? I tryed to play an animation for a player under OnPlayerPrepareToDeath but it doesn't work.
pawn Code:
public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time) {
    //set the string contents
    format(animlib, 32, "library");
    format(animname, 32, "name");
    anim_lock = 1;
    respawn_time = 10000;
    //rest of code
}
Reply

Quote:
Originally Posted by Crayder
View Post
pawn Code:
public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time) {
    //set the string contents
    format(animlib, 32, "library");
    format(animname, 32, "name");
    anim_lock = 1;
    respawn_time = 10000;
    //rest of code
}
Thanks, Crayder!
Reply

Could just do:
pawn Code:
public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time) {
    animlib = "lib";
    animname = "anim";
}
No need to use string copy functions when the array size is known. And format should never be used to copy strings.
Reply

Quote:
Originally Posted by Slice
View Post
No need to use string copy functions when the array size is known. And format should never be used to copy strings.
Yes, I know that. It was just a very quick example that I had off the top of my head.
Reply

I found what seems to be a bug.

Code:
[14:35:44] [debug] Run time error 4: "Array index out of bounds"
[14:35:44] [debug]  Accessing element at index 65535 past array upper bound 999
[14:35:44] [debug] AMX backtrace:
[14:35:44] [debug] #0 0004b8a8 in public WC_OnPlayerDamage (&playerid=@0162e174 0, &Float:amount=@0162e178 4.95000, &issuerid=@0162e17c 65535, &weapon=@0162e180 54, &bodypart=@0162e184 3) at modulations/callbacks.pwn:315
[14:35:44] [debug] #1 00040264 in public OnPlayerDamage (&playerid=@0162e174 0, &Float:amount=@0162e178 4.95000, &issuerid=@0162e17c 65535, &weapon=@0162e180 54, &bodypart=@0162e184 3) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:5232
[14:35:44] [debug] #2 000380fc in InflictDamage (playerid=0, Float:amount=4.95000, issuerid=65535, weaponid=54, bodypart=3) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:4387
[14:35:44] [debug] #3 0002f834 in ?? (... <5 arguments>) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:3244
[14:35:44] [debug] #4 00015fc4 in public OnPlayerTakeDamage (playerid=0, issuerid=65535, Float:amount=4.95000, weaponid=54, bodypart=3) at C:\Program Files (x86)\Pawno\include\YSI\y_hooks/impl.inc:2365
The above errors are what appeared in console after a player was hit by heli-blades, thrown and landed. The damage they took from landing caused those. I return 0'd to prevent heliblade damage, but for some reason, the damage a player takes after being thrown makes that happen.
Reply

Quote:
Originally Posted by MartinSwag
View Post
I found what seems to be a bug.

Code:
[14:35:44] [debug] Run time error 4: "Array index out of bounds"
[14:35:44] [debug]  Accessing element at index 65535 past array upper bound 999
[14:35:44] [debug] AMX backtrace:
[14:35:44] [debug] #0 0004b8a8 in public WC_OnPlayerDamage (&playerid=@0162e174 0, &Float:amount=@0162e178 4.95000, &issuerid=@0162e17c 65535, &weapon=@0162e180 54, &bodypart=@0162e184 3) at modulations/callbacks.pwn:315
[14:35:44] [debug] #1 00040264 in public OnPlayerDamage (&playerid=@0162e174 0, &Float:amount=@0162e178 4.95000, &issuerid=@0162e17c 65535, &weapon=@0162e180 54, &bodypart=@0162e184 3) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:5232
[14:35:44] [debug] #2 000380fc in InflictDamage (playerid=0, Float:amount=4.95000, issuerid=65535, weaponid=54, bodypart=3) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:4387
[14:35:44] [debug] #3 0002f834 in ?? (... <5 arguments>) at C:\Program Files (x86)\Pawno\include\weapon-config.inc:3244
[14:35:44] [debug] #4 00015fc4 in public OnPlayerTakeDamage (playerid=0, issuerid=65535, Float:amount=4.95000, weaponid=54, bodypart=3) at C:\Program Files (x86)\Pawno\include\YSI\y_hooks/impl.inc:2365
The above errors are what appeared in console after a player was hit by heli-blades, thrown and landed. The damage they took from landing caused those. I return 0'd to prevent heliblade damage, but for some reason, the damage a player takes after being thrown makes that happen.
Looks like the 'bug' is in YOUR script. You're probably trying to use `issuerid` somewhere it shouldn't be used, most likely a 'MAX_PLAYERS' array. Validate the ID before using it.
Reply

Quote:
Originally Posted by Crayder
View Post
Looks like the 'bug' is in YOUR script. You're probably trying to use `issuerid` somewhere it shouldn't be used, most likely a 'MAX_PLAYERS' array. Validate the ID before using it.
Oh, I found the issue, and I did not have a check for INVALID_PLAYER_ID. Thank you, I completely forgot about that! One more thing I've run into is the class selection screen. It seems I go into player class selection if I die while inside a vehicle that explodes. I always respawn just fine, but if I'm in a vehicle for example, and another player hits me with an RPG (and the vehicle explodes, killing me), I'm sent to player class selection. Could this be potentially caused by my scripting? Thanks.
Reply

Quote:
Originally Posted by MartinSwag
View Post
Oh, I found the issue, and I did not have a check for INVALID_PLAYER_ID. Thank you, I completely forgot about that! One more thing I've run into is the class selection screen. It seems I go into player class selection if I die while inside a vehicle that explodes. I always respawn just fine, but if I'm in a vehicle for example, and another player hits me with an RPG (and the vehicle explodes, killing me), I'm sent to player class selection. Could this be potentially caused by my scripting? Thanks.
That is done on purpose. Vehicle explosion deaths are impossible to prevent, so as an alternative to doing so players are sent to class selection.

EDIT: Actually in the latest versions it is skipped.
Reply

What crayder said applies for older versions. It should work without problems, but you may be doing something to cause it.

Do you use ForceClassSelection?

Do you use OnPlayerRequestClass in a filterscript?
Reply

Quote:
Originally Posted by Slice
View Post
What crayder said applies for older versions. It should work without problems, but you may be doing something to cause it.

Do you use ForceClassSelection?

Do you use OnPlayerRequestClass in a filterscript?
That is odd, I don't force class selection, nor do I have any callbacks for it in my filterscript (only using Simon's debug). I tried loading up the default grand larceny server, and the issue didn't occur. The only thing I can think of that may be causing this is my login and registration system. I use SetSpawnInfo and SpawnPlayer afer they login/register. Could this be causing the issue?
Reply

Enable debug and show me the output.
pawn Code:
#define WC_DEBUG true
#include <weapon-config>
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)