AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   This plugin crashes my server (natives help!) (https://forums.alliedmods.net/showthread.php?t=282706)

KaLoIaN 05-15-2016 09:41

This plugin crashes my server (natives help!)
 
Thanks to everybody
#trashit

Whitez 05-15-2016 11:42

Re: This plugin crashes my server
 
Remove natives and see if it works

SpeeDeeR 05-15-2016 12:47

Re: This plugin crashes my server
 
it's probably Nvault causing the crash.
Your save file maybe corrupted.

KaLoIaN 05-15-2016 15:12

Re: This plugin crashes my server
 
No it wasn't from nVault.
It was from the natives , I mean not plugin_natives() the other part of natives idk how it is called in english lol..

what's the problem with them???
When I quoted them - the server stopped crashes?

KaLoIaN 05-15-2016 15:16

Re: This plugin crashes my server
 
The problem is with this native:

/*
public native_get_user_level(id)
{
return g_iLevel[id]
}
*/

All others are not quoted and server is working, when I unquote this one server stops working.

SpeeDeeR 05-15-2016 15:47

Re: This plugin crashes my server
 
Use style=0, and look up how the native callback is defined.
https://forums.alliedmods.net/showthread.php?t=41251

Whitez 05-15-2016 17:04

Re: This plugin crashes my server
 
Look up into other similar plugins to see how natives are properly done
By the way, you forgot to register_library in plugin_natives

KaLoIaN 05-19-2016 09:44

Re: This plugin crashes my server
 
Removed

PHP Code:

#include <LevelSystem> 

and added

PHP Code:

    register_library("LevelSystem"

and not worked.

Then 2nd try:

Changed the native to:

PHP Code:

register_native("zp_get_user_level""native_get_user_level"

not worked lol

3rd try:

Changed the native to:

PHP Code:

register_native("zp_get_user_level""native_get_user_level"0

again not worked.

Looked at another plugins and the natives are registered 100% the same way as mine (you can take a look of ZP 4.3 plugin for example it's the same [I've took the example out of there])


The library (LevelSystem):

PHP Code:

native zp_get_user_level(id)
native zp_set_user_level(idamount)

native zp_get_user_exp(id)
native zp_set_user_exp(idamount)

native zp_get_user_reset(id)
native zp_set_user_reset(idamount)

native zp_get_user_boost(id)
native zp_set_user_boost(idamount)

native zp_get_user_escapes(id)
native zp_set_user_escapes(idamount

Any help will be appreciated.


P.S.
The suspicous thing is the server.cfg file is executed twice. How I got that?
I wrote:

PHP Code:

echo Server.CFG Executed

at server.cfg and when start server at console it writes this twice and then the server has crashed.

Black Rose 05-19-2016 11:43

Re: This plugin crashes my server (natives help!)
 
Code:
public native_get_user_level(id)   {     return g_iLevel[id] } public native_set_user_level(id, amount)   {     g_iLevel[id] = amount }
To make this style 0 you do this:
Code:
public native_get_user_level(PluginID, NumParams) {     return g_iLevel[get_param(1)] } public native_set_user_level(PluginID, NumParams) {     g_iLevel[get_param(1)] = get_param(2) }

KaLoIaN 05-20-2016 08:36

Re: This plugin crashes my server (natives help!)
 
Quote:

Originally Posted by Black Rose (Post 2420176)
Code:
public native_get_user_level(id)   {     return g_iLevel[id] } public native_set_user_level(id, amount)   {     g_iLevel[id] = amount }
To make this style 0 you do this:
Code:
public native_get_user_level(PluginID, NumParams) {     return g_iLevel[get_param(1)] } public native_set_user_level(PluginID, NumParams) {     g_iLevel[get_param(1)] = get_param(2) }

Again it crashes...


All times are GMT -4. The time now is 16:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.