SA-MP Forums Archive
Variable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Variable (/showthread.php?tid=117085)



Variable - TouR - 31.12.2009

can someone tell me how to save a variable? e.g new clan[MAX_PLAYERS];


Re: Variable - Correlli - 31.12.2009

You could use dINI/dUDB for that.


Re: Variable - TouR - 31.12.2009

yeah i know can you give me an example?



Re: Variable - Correlli - 31.12.2009

There are enough examples in this topic.


Re: Variable - Mike Garber - 31.12.2009

Quote:
Originally Posted by tour15
can someone tell me how to save a variable? e.g new clan[MAX_PLAYERS];
pawn Код:
new clan[MAX_PLAYERS]; // Ontop of your script

// And when you wanna set the player to that, either with command or with a public function w/e;

clan[playerid] = 1; // Wherever you want to set the player to this

// And If you wanna check that, wherever, use this;

if((clan[playerid]==1)){
// do w/e
}else{
// do w/e if he's not
return 1;
}



Re: Variable - Correlli - 31.12.2009

Quote:
Originally Posted by mavtias
Quote:
Originally Posted by tour15
can someone tell me how to save a variable? e.g new clan[MAX_PLAYERS];
pawn Код:
/* code */
He was not asking how to set or check a variable, he was asking how to save it.


Re: Variable - Mike Garber - 31.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by mavtias
Quote:
Originally Posted by tour15
can someone tell me how to save a variable? e.g new clan[MAX_PLAYERS];
pawn Код:
/* code */
He was not asking how to set or check a variable, he was asking how to save it.
Well, my code does save It the way he asked for, not the way you suggested.
It's saved until he disconnects, in the variable without scriptfiles....


Re: Variable - Correlli - 31.12.2009

Quote:
Originally Posted by mavtias
Well, my code does save It the way he asked for, not the way you suggested.
It's saved until he disconnects, in the variable without scriptfiles....
No, your way does not save it, he was asking how to save it permanent, not temporary.


Re: Variable - Mike Garber - 31.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by mavtias
Well, my code does save It the way he asked for, not the way you suggested.
It's saved until he disconnects, in the variable without scriptfiles....
No, your way does not save it, he was asking how to save it permanent, not temporary.
Where does It say permament?
He showed us the way he'd like to use It, and I made an example how he can do It the way he asked for.


Re: Variable - Donny_k - 31.12.2009

Quote:
Originally Posted by mavtias
Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by mavtias
Well, my code does save It the way he asked for, not the way you suggested.
It's saved until he disconnects, in the variable without scriptfiles....
No, your way does not save it, he was asking how to save it permanent, not temporary.
Where does It say permament?
He showed us the way he'd like to use It, and I made an example how he can do It the way he asked for.
He says "save" not "store", you save data in files, you store values in variables which are destroyed at gmx.


Re: Variable - Mike Garber - 31.12.2009

Well, you don't save It in scriptfiles the way he showed us. Maybe he meant "store" temporarily, because I was just finishing his example, how to use it.


Re: Variable - Donny_k - 31.12.2009

Quote:
Originally Posted by mavtias
Well, you don't save It in scriptfiles the way he showed us. Maybe he meant "store" temporarily, because I was just finishing his example, how to use it.
Indeed you don't, you are correct if he meant how to store a value in a variable but if he meant to save the variables value at gmx then you would require file IO like has been said.


Re: Variable - Mike Garber - 31.12.2009

Quote:
Originally Posted by Donny
Quote:
Originally Posted by mavtias
Well, you don't save It in scriptfiles the way he showed us. Maybe he meant "store" temporarily, because I was just finishing his example, how to use it.
Indeed you don't, you are correct if he meant how to store a value in a variable but if he meant to save the variables value at gmx then you would require file IO like has been said.
Yeah.


Re: Variable - TouR - 01.01.2010

hey guys the thing i meant is that i want to temporary save it... how can i make when a player disconect save the variable?


Re: Variable - Mike Garber - 01.01.2010

Quote:
Originally Posted by tour15
hey guys the thing i meant is that i want to temporary save it... how can i make when a player disconect save the variable?
Temporary Is used when you don't wanna save It on disconnect.
Permament Is when you save It forever, well, until you decide to change it.

Temporary; as my example
Permament;
dini/dubd


Re: Variable - TouR - 01.01.2010

i want to use this forever sorry for my bad english


Re: Variable - Correlli - 01.01.2010

Quote:
Originally Posted by tour15
i want to use this forever sorry for my bad english
I already told you, use dINI/dUDB.


Re: Variable - TouR - 01.01.2010

I saw the tutorials but that made me more confused...