[SOLVED] fixing script
#1

Quote:
Originally Posted by fromdudbthread
add modify good for LVDM.
He check when user is registered and when is not login in 60s, kick him.

Код:
//authorize timeout
#define AUTH_TIMEOUT 60000
#define NOTIFY_TIME 10000
#define NOTIFY_TIMEOUT 15000
//player timer ids
new PLAYERLIST_timer[MAX_PLAYERS];
create user timer when is player registered
Код:
public OnPlayerConnect(playerid) {
 	PLAYERLIST_authed[playerid]=false;
  //have account?
	if(udb_Exists(PlayerName(playerid))){
	  new str[50];
		SystemMsg(playerid,"This user have account pleas register to 60s or you be kicked!(/login pass)");
		format(str,sizeof(str),"TIPL_%i",playerid);
		PLAYERLIST_timer[playerid] = SetTimer(str,AUTH_TIMEOUT,0);
		format(str,sizeof(str),"TNOT_%i",playerid);
		PLAYERLIST_timer[playerid] = SetTimer(str,NOTIFY_TIME,0);
	}
	else{
	  SystemMsg(playerid,"You can register /register pass");
	}
	return true;
}

user timer function:
Code:
//optimize this SetTimerEx (from tse) not work!
public TIPL_0(){TimerIsPlayerLoged(1);}
.....
.....
public TIPL_99(){TimerIsPlayerLoged(99);}


public TimerIsPlayerLoged(playerid){
	new str[256];
	if(!IsPlayerConnected(playerid))
	  return;
	if(PLAYERLIST_authed[playerid]){
	  SystemMsg(COLOR_SYSTEM,"Byl jsi uspesne autorizovan!");
	}
	else{
		format(str,sizeof(str),"User %s has not be autorized, kicked!",PlayerName(playerid));
		SendClientMessageToAll(COLOR_SYSTEM,str);
		Kick(playerid);
	}
}
Notify text timer function:
Code:
//optimize this SetTimerEx (from tse) not work!
Код:
public TNOT_0(){TimerNotify(0);}
....
....
public TNOT_99(){TimerNotify(99);}

public TimerNotify(playerid){
	if(!IsPlayerConnected(playerid))
	  return;
 	SystemMsg(playerid,"This user have account pleas register to 60s or you be kicked!(/login pass)");
	GameTextForPlayer(playerid,"~R~This user have account pls register to 60s or you be kicked!(/login pass)",NOTIFY_TIMEOUT,1);
}
Kill timer when player disconect:
Код:
public OnPlayerDisconnect(playerid) {
 ..
 KillTimer(PLAYERLIST_timer[playerid]);
...
}
This is all, not optimized code, thx for help with optimizing...

btw: is good add timer for save world(when server crasht), after 5 min interval save all connected user money.
can someone complete this script? As I'd like to have this, it's a timer which kicks a player when he/she is not logged in after a minute. And it is with a textdraw which I don't fully know how to add that. I'd be happy if someone could complete it. (a/o explain me on how to) (It sounds lazy of me, but I really don't know how to make this)

Thanks in advance
Reply


Messages In This Thread
[SOLVED] fixing script - by KnooL - 25.12.2009, 23:15
Re: fixing script - by [HiC]TheKiller - 26.12.2009, 02:48
Re: fixing script - by KnooL - 26.12.2009, 10:08
Re: fixing script - by KnooL - 28.12.2009, 20:59
Re: fixing script - by [HiC]TheKiller - 28.12.2009, 21:04
Re: fixing script - by KnooL - 28.12.2009, 21:13
Re: fixing script - by KnooL - 29.12.2009, 21:05
Re: fixing script - by Oxside - 29.12.2009, 21:10
Re: fixing script - by KnooL - 29.12.2009, 21:14
Re: fixing script - by Oxside - 29.12.2009, 21:27

Forum Jump:


Users browsing this thread: 1 Guest(s)