Dini question :(
#1

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
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)