Raised This Month: $85 Target: $400
 21% 

what is wrong with my code ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 09-24-2020 , 23:06   what is wrong with my code ?
Reply With Quote #1

What's happening is when I tested it on my server, I get log errors on logs folder from my server (it says to enable debug mode). but when I compile. it compiles without errors.

PHP Code:
on top:
new 
getmoney[33]


mid of the command:
if (
getmoney[id] >= 2)
    {
        
client_print(idprint_chat"You cant use it now.")
        return;
    }
// if he didnt get his money more than 2 times
getmoney[id]++ 
Mankled is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 09-24-2020 , 23:24   Re: what is wrong with my code ?
Reply With Quote #2

What you are trying to do ?? or show me all plugin !!
__________________

Last edited by Supremache; 09-24-2020 at 23:28.
Supremache is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-24-2020 , 23:37   Re: what is wrong with my code ?
Reply With Quote #3

It said to enable debug so you should enable debug. When you get the full error with debug enabled, you'll get a much better idea of what is actually wrong. If you still can't figure it out, post that entire output here with the entire plugin.
__________________

Last edited by fysiks; 09-24-2020 at 23:39.
fysiks is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 09-25-2020 , 14:52   Re: what is wrong with my code ?
Reply With Quote #4

Quote:
Originally Posted by Mankled View Post
What's happening
EXACTLY what we're asking here. You tell us.
__________________
Black Rose is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 09-26-2020 , 00:12   Re: what is wrong with my code ?
Reply With Quote #5

I enabled debug mode and I found the problem, but i dont know how to solve it:

I use ZPA mode and im getting the error on line 2518:

PHP Code:
if (g_nemesis[victim] || g_assassin[victim] || (g_assassin[attacker] && get_pcvar_num(cvar_nemfraggore))) 
Error:
PHP Code:
L 09/25/2020 14:10:34: [AMXX]    [0zombie_plague_advance_v1-6-1.sma::fw_PlayerKilled (line 2518)
L 09/25/2020 14:10:34: [AMXXDisplaying debug trace (plugin "zombie_plague_advance_v1-6-1.amxx")
L 09/25/2020 14:10:34: [AMXXRun time error 4index out of bounds 
Here is the .sma
Attached Files
File Type: sma Get Plugin or Get Source (zombie_plague_advance_v1-6-1.sma - 10 views - 418.1 KB)
Mankled is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 09-26-2020 , 05:29   Re: what is wrong with my code ?
Reply With Quote #6

Code:
if (g_nemesis[victim] || g_assassin[victim] || ( is_user_connected(attacker) && g_assassin[attacker] && get_pcvar_num(cvar_nemfraggore)))
__________________

Last edited by Black Rose; 09-27-2020 at 08:08.
Black Rose is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-26-2020 , 23:55   Re: what is wrong with my code ?
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
Code:
if (g_nemesis[victim] || g_assassin[victim] || ( is_user_alive(attacker) && g_assassin[attacker] && get_pcvar_num(cvar_nemfraggore)))
If this is the fix, you should explain what you actually did so people can understand without having to intimately inspect the code that you posted and assume that what you posted is the fix. The Scripting Help forum is for learning after all.

Checking if the attacker is alive is not the proper solution to this problem. Whether or not a player is dead or alive is not a cause of an index out-of-bounds error. Also, the attacker might not be alive but the action should likely still happen. I believe that the proper solution is to check if the attacker is an actual player i.e. 0 < attacker < maxplayers
__________________

Last edited by fysiks; 09-27-2020 at 00:26.
fysiks is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 09-27-2020 , 08:08   Re: what is wrong with my code ?
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
If this is the fix, you should explain what you actually did so people can understand without having to intimately inspect the code that you posted and assume that what you posted is the fix. The Scripting Help forum is for learning after all.

Checking if the attacker is alive is not the proper solution to this problem. Whether or not a player is dead or alive is not a cause of an index out-of-bounds error. Also, the attacker might not be alive but the action should likely still happen. I believe that the proper solution is to check if the attacker is an actual player i.e. 0 < attacker < maxplayers
Actually posting code > bitching about posts in the wrong forum, non-descriptive titles, et.c.

This is a forum. It's somewhat of a dialogue. If the user responds with "I don't understand, can you explain" I would. The change is so small that comparing it is so easy there's no point of explaining. The thread author also doesn't seem to have any knowledge of coding and also no interest in changing that.
__________________

Last edited by Black Rose; 09-27-2020 at 08:19.
Black Rose is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-27-2020 , 14:40   Re: what is wrong with my code ?
Reply With Quote #9

Quote:
Originally Posted by Black Rose View Post
This is a forum. It's somewhat of a dialogue. If the user responds with "I don't understand, can you explain" I would. The change is so small that comparing it is so easy there's no point of explaining. The thread author also doesn't seem to have any knowledge of coding and also no interest in changing that.
It's just a waste of time to not explain it, it would take like 20 seconds to do in your original post. Just because you believe that the poster doesn't have knowledge of coding doesn't mean you can't explain it so that he or she can learn. Also, people may come in the future and be curious why you made such a change.
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-28-2020 , 09:30   Re: what is wrong with my code ?
Reply With Quote #10

Such a problem have atons of solutions meaning that if the User searched for a solution he will definitely find one, instead of making a useless thread.
__________________
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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

Forum Jump


All times are GMT -4. The time now is 22:45.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode