Getting any variable value with a command
#1

So basically, is it possible for the format to return the proper variable value in the following code? For example, If I have a variable in the server called IsCool[playerid]. I will type "/checkv IsCool" and it will return me what my current value for "IsCool[playerid]" is, and it will work with any variable that exists in the script, please let me know if this is possible and if so, elaborate. Thanks alot!

Код:
	format(string1,sizeof(string1),"%s[playerid]",params); // what i typed in the command "/checkv [variable]"
	format(string2,sizeof(string2),"%d",string1); //Trying to retrieve the value from the "[variable]"
	format(string3,sizeof(string3),"%s == %d",string1,string2); //Trying to return it to me "[variable] == [value]"
Reply
#2

never tryed ...no i think this will only print..
Reply
#3

Well obviously this is not the entire command, all the rest is irrelevent
Reply
#4

yes but you have to compile it to work .. so you cant "print" the script

you can try this http://forum.sa-mp.com/showthread.ph...highlight=Exec can help ..
Reply
#5

Ok you are misunderstanding this entire question
Reply
#6

No, not possible. There might be a way (#emit), but it requires a lot of knowledge about PAWN and AMX.
Reply
#7

I don't think it's possible, even through the use of emit. Variable and functions names are merely stored as addresses in memory and cannot be accessed by name. The exceptions being public functions and variables.

Variables can be declared public as well, but I'm not sure how that would work out as it's never been used before.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
I don't think it's possible, even through the use of emit. Variable and functions names are merely stored as addresses in memory and cannot be accessed by name. The exceptions being public functions and variables.

Variables can be declared public as well, but I'm not sure how that would work out as it's never been used before.
Yes, but I was thinking maybe it's possible to make a table where all names and addresses of variables are saved, so it's possible to look up variable addresses by name and show the values. Just a thought, I'm not very familiar with #emit.

EDIT: And if not with #emit, maybe a plugin?
Reply
#9

Hmm, Sounds like impossible if Pawn works the same way as C+ with this.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)