AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invalid return type when using pev with DOD ?? (https://forums.alliedmods.net/showthread.php?t=29179)

Geesu 05-31-2006 12:40

Invalid return type when using pev with DOD ??
 
This is the code:

Code:
new iVal; iVal = pev( id, 1 );

And I get invalid return type??? anyone know why? (it occurs in day of defeat but not CS/CZ)

Thanks,
Josh

VEN 05-31-2006 13:10

try that:
Code:
new iVal, sz[32]; iVal = pev( id, 1, sz, 31 );

Geesu 05-31-2006 13:26

OK that works for a little...

I'm basically doing:

Code:
public test( id ) {     new iVal, sz[32];     for ( new i = 1; i < 145; i++ )     {         iVal = pev( id, i, sz, 31 );         server_print( "[%d] %d", i, iVal );     } }

I get invalid return type when i is greater than 11 and i also get the error "unknown pev index or return combination 12"

This is really confusing, why won't pev just work in dod?

VEN 05-31-2006 13:35

There are Float, Int, Vec and Sz PEVs, therefore you cant just do
Code:
pev( id, i, sz, 31 );
or
Code:
pev( id, i );
for all of them.

For example 1st is a string:
Code:
pev( id, 1, sz, 31 ) // classname
#17 is an integer:
Code:
x = pev( id, 17 ) // aiment
#41 is a float:
Code:
pev( id, 41, f_by_ref ) // health
#118 is a vector:
Code:
pev( id, 118, Vec ) // origin

Geesu 05-31-2006 13:42

OK so there isn't a way for me to just loop through all of them though?

i.e. I just want to loop through all the ints

Greenberet 05-31-2006 14:00

Code:
for( new i = pev_int_start + 1; i < pev_int_end; i++ )         client_print( id, print_chat, "PevId: %i | Value %i", i, pev( id, i ) );

try this ;)

Geesu 05-31-2006 14:36

Quote:

Originally Posted by Greenberet
Code:
for( new i = pev_int_start + 1; i < pev_int_end; i++ )         client_print( id, print_chat, "PevId: %i | Value %i", i, pev( id, i ) );

try this ;)

Thats what I was doing originally and it errors out after so many...

Greenberet 05-31-2006 14:57

Message overflow?
if yes
Code:
static text[256],temp[32]; for( new i = pev_int_start + 1; i < pev_int_end; i++ ) {         formatex( temp, 31, "PevID %i | Value %i^n", i, pev(id,i));         add( text, 256, temp ); } client_print( id, print_console, "%s", text );

Geesu 05-31-2006 18:31

no, the first error in this thread... I do server_print to prevent overflow :) Come on I'm not a noob :P


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

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