SA-MP Forums Archive
Dini question :( - 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: Dini question :( (/showthread.php?tid=92760)



Dini question :( - Yoyoyo - 22.08.2009

I am making a script so when people are in jail and if they die or disconnect, they go back to jail when they come back.

When he goes to jail a variable called JailTime will determine how long he is in jail.


When he goes to jail
Код:
JailTime=320;
dini_IntSet("/JailTime/Jail.ini", playername, JailTime); // will this show up as playername=320(or whatever his time is??)
When he spawns
Код:
OnPlayerSpawn(playerid)
{
	if(dini_Int("/JailTime/Jail.ini", playername) != 0) //checking if he has time left
	{
		SetPlayerPos(...
		dini_Int("JailTime/Jail.ini", playername); //gets stuff from his jailtime (playername=wateva)
		JailTime=JailTime; //will that work? its getting the varriable stored inside the .ini file ^^ and putting it in the jailtime varriable in the script. ..
	return 1;
}
thanks a lot


Re: Dini question :( - Gamer_Z - 22.08.2009

try to look at this:
pawn Код:
public OnPlayerConnect(playerid){
    if (dini_Exists(udb_encode(PlayerName(playerid)))) {
        new tmp[256];
        tmp = dini_Get(udb_encode(PlayerName(playerid)), "bank");
        bankmoney[playerid] = strval(tmp);
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason){
    if (dini_Exists(udb_encode(PlayerName(playerid)))) {
        dini_IntSet(udb_encode(PlayerName(playerid)), "bank", bankmoney[playerid]);
    }
    bankmoney[playerid] = 0;
    return 1;
}
good example of dini/dudb