AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Run time error : native error (https://forums.alliedmods.net/showthread.php?t=139893)

SaM.ThE.MaN 10-06-2010 14:01

Run time error : native error
 
1 Attachment(s)
I am getting all these errors :

PHP Code:

L 10/06/2010 21:47:49Invalid CVAR pointer
L 10
/06/2010 21:47:49: [AMXXDisplaying debug trace (plugin "Newest.amxx")
L 10/06/2010 21:47:49: [AMXXRun time error 10native error (native "get_pcvar_num")
L 10/06/2010 21:47:49: [AMXX]    [0Newest.sma::HumanAndZombieHealth (line 439)
L 10/06/2010 21:47:49: [AMXX]    [1Newest.sma::ChangeClass (line 421)
L 10/06/2010 21:47:49: [AMXX]    [2Newest.sma::client_putinserver (line 

PHP Code:

L 10/06/2010 21:47:49Invalid CVAR pointer
L 10
/06/2010 21:47:49: [AMXXDisplaying debug trace (plugin "Newest.amxx")
L 10/06/2010 21:47:49: [AMXXRun time error 10native error (native "get_pcvar_num")
L 10/06/2010 21:47:49: [AMXX]    [0Newest.sma::HumanAndZombieHealth (line 439)
L 10/06/2010 21:47:49: [AMXX]    [1Newest.sma::ChangeClass (line 421)
L 10/06/2010 21:47:49: [AMXX]    [2Newest.sma::client_putinserver (line 


SaM.ThE.MaN 10-06-2010 14:02

Re: Run time error : native error
 
More errors , but they all have the same problem , so i can fix the rest my self

Bugsy 10-06-2010 21:56

Re: Run time error : native error
 
::sigh:: Just use if-statements or a switch dude, this is ridiculous.

PHP Code:

get_pcvar_numArcticHealth ) : ( hClass == Gign ) ? get_pcvar_numGignHealth ) : ( hClass == Gsg9 ) ? get_pcvar_numGsg9Health ) : ( hClass == Guerilla ) ? get_pcvar_numGuerillaHealth ) : ( hClass == Leet ) ? get_pcvar_numLeetHealth ) : ( hClass == Sas ) ? get_pcvar_numSasHealth ) : ( hClass == Terror ) ? get_pcvar_numTerrorHealth ) : ( hClass == Urban ) ? get_pcvar_numUrbanHealth ) : get_pcvar_numVipHealth ) ) 

Would be very nice formatted like this or you could go a step further use an enum\struct for each player with all settings (health,speed, etc).
PHP Code:

new iHealthCVar;

switch( 
hClass )
{
    case 
ArcticiHealthCVar ArcticHealth;
    case 
CigniHealthCVar GignHealth;
    case 
Gsg9iHealthCVar Gsg9Health;
    case 
GuerillaiHealthCVar GuerillaHealth;
    case 
LeetiHealthCVar LeetHealth;
    case 
SasiHealthCVar SasHealth;
    case 
TerroriHealthCVar TerrorHealth;
    case 
UrbaniHealthCVar UrbanHealth;
    default: 
iHealthCVar VipHealth;
}

fm_set_user_healthid get_pcvar_numiHealthCVar ) ); 

Your error may be caused by how you are declaring your cvars (preceded by a space).

PHP Code:

ArcticHealth register_cvar" Arctic_Health""150" )
ArcticSpeed register_cvar" Arcitc_Speed""400" 


fysiks 10-06-2010 23:06

Re: Run time error : native error
 
Quote:

Originally Posted by Bugsy (Post 1317591)
Your error may be caused by how you are declaring your cvars (preceded by a space).

PHP Code:

ArcticHealth register_cvar" Arctic_Health""150" )
ArcticSpeed register_cvar" Arcitc_Speed""400" 


I was unable to recreate this error with a test plugin. The cvar worked! Granted, you had to use quotes to set it via server console.

EDIT: What is funny however, is that that single space is the only space that will work :). A single space elsewhere or more than one will not work.

SaM.ThE.MaN 10-07-2010 04:29

Re: Run time error : native error
 
no difference , even when i use :
PHP Code:

new iHealthCVar;

switch( 
hClass )
{
    case 
ArcticiHealthCVar ArcticHealth;
    case 
CigniHealthCVar GignHealth;
    case 
Gsg9iHealthCVar Gsg9Health;
    case 
GuerillaiHealthCVar GuerillaHealth;
    case 
LeetiHealthCVar LeetHealth;
    case 
SasiHealthCVar SasHealth;
    case 
TerroriHealthCVar TerrorHealth;
    case 
UrbaniHealthCVar UrbanHealth;
    default: 
iHealthCVar VipHealth;
}

fm_set_user_healthid get_pcvar_numiHealthCVar ) ); 

it still gives me the same error ...

Bugsy 10-07-2010 10:01

Re: Run time error : native error
 
Why don't you confirm that all of the cvar pointers are valid. This is how you find the source of errors on your own.

SaM.ThE.MaN 10-07-2010 10:10

Re: Run time error : native error
 
and how do i confirm that all my cvar pointers are valid?

Bugsy 10-07-2010 10:29

Re: Run time error : native error
 
Print them to console or chat

I would also confirm all of your code in plugin init is correct. ie, if you register forwards, be sure the forward function matches the function name when registered. I've seen this cause a similar error that turns out to be completely unrelated to the cvars.

SaM.ThE.MaN 10-07-2010 10:39

Re: Run time error : native error
 
i still dont get it , do you want me to do something like this

Client_print(id, print_chat, "Your HP is %i", ArcticHealth)

is this a way to confirm that it is a valid cvar?

Bugsy 10-07-2010 10:55

Re: Run time error : native error
 
Just do them all in the same print (%d %d %d etc). Also do what I suggested above.


All times are GMT -4. The time now is 10:24.

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