SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 11/10/2015, 08:06 PM   #341
RogerCosta
Huge Clucker
 
RogerCosta's Avatar
 
Join Date: Aug 2014
Location: Santos, Brazil.
Posts: 282
Reputation: 92
Default Re: weapon-config.inc - Damage system with many features

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.
RogerCosta is offline   Reply With Quote
Old 13/10/2015, 07:11 PM   #342
ExTaZZ69
Big Clucker
 
ExTaZZ69's Avatar
 
Join Date: Mar 2015
Location: Romania
Posts: 128
Reputation: 23
Default Re: weapon-config.inc - Damage system with many features

How can i customize death atnimations? I tryed to play an animation for a player under OnPlayerPrepareToDeath but it doesn't work.
ExTaZZ69 is offline   Reply With Quote
Old 13/10/2015, 08:07 PM   #343
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,324
Reputation: 652
Default Re: weapon-config.inc - Damage system with many features

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
}
Crayder is offline   Reply With Quote
Old 13/10/2015, 08:44 PM   #344
ExTaZZ69
Big Clucker
 
ExTaZZ69's Avatar
 
Join Date: Mar 2015
Location: Romania
Posts: 128
Reputation: 23
Default Re: weapon-config.inc - Damage system with many features

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!
ExTaZZ69 is offline   Reply With Quote
Old 13/10/2015, 08:53 PM   #345
Slice
High-roller
 
Join Date: Mar 2008
Posts: 1,831
Reputation: 1607
Default Re: weapon-config.inc - Damage system with many features

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.
Slice is offline   Reply With Quote
Old 14/10/2015, 11:34 AM   #346
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,324
Reputation: 652
Default Re: weapon-config.inc - Damage system with many features

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.
Crayder is offline   Reply With Quote
Old 25/10/2015, 08:47 PM   #347
MartinSwag
Little Clucker
 
MartinSwag's Avatar
 
Join Date: Aug 2015
Location: The Netherlands
Posts: 40
Reputation: 2
Default Re: weapon-config.inc - Damage system with many features

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.
MartinSwag is offline   Reply With Quote
Old 25/10/2015, 08:52 PM   #348
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,324
Reputation: 652
Default Re: weapon-config.inc - Damage system with many features

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.
Crayder is offline   Reply With Quote
Old 26/10/2015, 05:05 PM   #349
MartinSwag
Little Clucker
 
MartinSwag's Avatar
 
Join Date: Aug 2015
Location: The Netherlands
Posts: 40
Reputation: 2
Default Re: weapon-config.inc - Damage system with many features

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.
MartinSwag is offline   Reply With Quote
Old 26/10/2015, 06:33 PM   #350
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,324
Reputation: 652
Default Re: weapon-config.inc - Damage system with many features

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.
Crayder is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with weapon damage system thanks JessThompson Scripting Help 7 15/07/2014 01:01 PM
[FilterScript] New Weapon Damage System [0.3z] RenSoprano Filterscripts 6 17/01/2014 06:03 AM
[FilterScript] Weapon damage system [v1.0] Darnell Filterscripts 74 21/10/2013 08:53 PM
[FilterScript] Weapon Damage System Donicans Filterscripts 14 06/11/2012 01:22 PM
[FilterScript] Realistic Weapon Damage And Death System [V1.0][New Cool FS] Nirzor Filterscripts 6 08/08/2012 05:34 AM


All times are GMT. The time now is 02:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.