SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 26/05/2020, 03:23 PM   #1
caiolelis1
Little Clucker
 
Join Date: Aug 2017
Posts: 6
Reputation: 0
Default Include weapon-config

Olá pessoa, alguem ai utiliza a include weapon-config? Quando eu utilizo ela, está bloqueando o dano de afogar , fogo e queda, e quando acontece o dano, da uma debug.

Code:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 65535 past array upper bound 102
[debug] AMX backtrace:
[debug] #0 00274730 in public WC_OnPlayerDamage (&playerid=@00dcb81c 3, &Float:amount=@00dcb820 165.00000, &issuerid=@00dcb824 65535, &weapon=@00dcb828 54, &bodypart=@00dcb82c 3) at C:\servidor\gamemodes\city.pwn:41918
[debug] #1 0007ec4c in public OnPlayerDamage (&playerid=@00dcb81c 3, &Float:amount=@00dcb820 165.00000, &issuerid=@00dcb824 65535, &weapon=@00dcb828 54, &bodypart=@00dcb82c 3) at C:\servidor\pawno\include\weapon-config.inc:5479
[debug] #2 0007756c in InflictDamage (playerid=3, Float:amount=165.00000, issuerid=65535, weaponid=54, bodypart=3, bool:ignore_armour=false) at C:\servidor\pawno\include\weapon-config.inc:4619
[debug] #3 0006e6fc in public OnPlayerTakeDamage (playerid=3, issuerid=65535, Float:amount=165.00000, weaponid=54, bodypart=3) at C:\servidor\pawno\include\weapon-config.inc:3406
include: https://forum.sa-mp.com/showthread.php?t=563387
caiolelis1 is offline   Reply With Quote
Old 26/05/2020, 04:57 PM   #2
RodrigoMSR
High-roller
 
RodrigoMSR's Avatar
 
Join Date: Mar 2015
Location: Brazil
Posts: 1,084
Reputation: 140
Default Re: Include weapon-config

Você está passando um issuerid inválido como índice de alguma array na callback OnPlayerDamage.

Ex:
PHP Code:
new Test[MAX_PLAYERS];

Test[issuerid] = 1
Uso correto:
PHP Code:
new Test[MAX_PLAYERS];

if(
issuerid != INVALID_PLAYER_ID)
{
    
Test[issuerid] = 1;

__________________
sttserver.net

RodrigoMSR is offline   Reply With Quote
Old 26/05/2020, 06:54 PM   #3
caiolelis1
Little Clucker
 
Join Date: Aug 2017
Posts: 6
Reputation: 0
Default Re: Include weapon-config

Mais tipo, "issuerid" é o causador do dano... Porém, o dano é de queda, fogo e afogamento que está dando o debug... Os danos causado por armas e tal, com um player definido como issuerid, não tem erro...
caiolelis1 is offline   Reply With Quote
Old 27/05/2020, 03:27 AM   #4
RodrigoMSR
High-roller
 
RodrigoMSR's Avatar
 
Join Date: Mar 2015
Location: Brazil
Posts: 1,084
Reputation: 140
Default Re: Include weapon-config

Quando o dano é de queda e etc., o issuerid vem com valor 65535 (INVALID_PLAYER_ID), por isso causa esse erro e o sistema trava. Você tem que checar se o issuerid é válido antes de usá-lo em arrays (igual no meu exemplo acima).

Code:
[debug]  Accessing element at index 65535 past array upper bound 102
Code:
[debug] #1 0007ec4c in public OnPlayerDamage (&playerid=@00dcb81c 3, &Float:amount=@00dcb820 165.00000, &issuerid=@00dcb824 65535, &weapon=@00dcb828 54, &bodypart=@00dcb82c 3) at C:\servidor\pawno\include\weapon-config.inc:5479
__________________
sttserver.net

RodrigoMSR is offline   Reply With Quote
Old 28/05/2020, 05:16 AM   #5
ReturnZero
Little Clucker
 
Join Date: May 2020
Posts: 14
Reputation: 0
Default Re: Include weapon-config

Tenho o mesmo problema, porém, não entendi o exemplo, pode me ajudar?
ReturnZero is offline   Reply With Quote
Old 28/05/2020, 11:53 PM   #6
MateGPlay
Big Clucker
 
MateGPlay's Avatar
 
Join Date: Jan 2018
Location: Florianópolis, Santa Catarina
Posts: 125
Reputation: 1
Default Re: Include weapon-config

Quote:
Originally Posted by ReturnZero View Post
Tenho o mesmo problema, porém, não entendi o exemplo, pode me ajudar?
Você precisa fazer uma checagem para ver se o issuerid é valido, como no codigo acima:

PHP Code:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID// If not self-inflicted
    
{
        
//seu codigo aqui
    
}
    return 
1;

MateGPlay 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
weapon config help cipi89 Scripting Help 4 08/05/2020 08:11 PM
[Pedido] Include para substituir Weapon Config razorcrash Português/Portuguese 0 03/07/2019 01:07 PM
weapon config include Dawkin Scripting Help 3 16/02/2019 07:46 PM
[Ajuda] Include weapon-config JuninTJF Português/Portuguese 3 06/09/2017 03:07 PM


All times are GMT. The time now is 12:15 AM.


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