Kick if you do not type the command?
#1

I made a Admin System, and it doesn't have Dialog. I want it so if you haven't type /register after a certain amount of time lets like 2 minutes. You will be kicked. Same for login. How can i do that. I know i would use a timer but how so. Please help me?
Reply
#2

pawn Код:
// top of script

new kicktimer;

// OnPlayerConnect

kicktimer = SetTimerEx("LoginKick",120000,false,"i",playerid); // 120,000 sec = 2 minutes

// bottom of script

forward LoginKick(playerid);
public LoginKick(playerid)
{
       // add your login/register variables and levels etc here I guess...
       // for example:
       if(PlayerInfo[playerid][LoggedIn] != 1) // if they are not logged in
       {
              Kick(playerid);
              SendCllientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
              KillTimer(kicktimer);
              // whatever messages u want
              // add whatever else
       }
}
Untested.

Should work, you get the idea?
Reply
#3

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
pawn Код:
// top of script

new kicktimer;

// OnPlayerConnect

kicktimer = SetTimerEx("LoginKick",120000,false,"i",playerid); // 120,000 sec = 2 minutes

// bottom of script

forward LoginKick(playerid);
public LoginKick(playerid)
{
       // add your login/register variables and levels etc here I guess...
       // for example:
       if(PlayerInfo[playerid][LoggedIn] != 1) // if they are not logged in
       {
              Kick(playerid);
              SendCllientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
              KillTimer(kicktimer);
              // whatever messages u want
              // add whatever else
       }
}
Untested.

Should work, you get the idea?
Testing it now, thanks. But it only says Server closed connection for the person. Any other ideas?
Reply
#4

pawn Код:
SendClientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
Use that line, I added too letter L's in Client in that line by mistake ^
Reply
#5

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
pawn Код:
SendClientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
Use that line, I added too letter L's in Client in that line by mistake ^
yea ik, i found that out when i first had it. But yet i never see that message
Reply
#6

You want it to send the auto-kick message to everyone?

Just change the current SendClientMessage the script had to:
pawn Код:
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s was auto kicked for failing to log in");
SendClientMessageToAll(color,string);
Reply
#7

I'm not sure, but its first kickking the player then SendClientMessage. So he disconnects but the server tries to send him a text after he disconnects. :
pawn Код:
Kick(playerid);
 SendClientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
Maybe you should try it like:
pawn Код:
SendClientMessage(playerid,color,"You Have Been Automatically Kicked. Reason:  Failed To Log-In On Time.");
 Kick(playerid);
Reply
#8

Ah yes, lawonama is right, that's why it probably didn't show the message

And adil, you forgot

new playername[24];
Reply
#9

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
Ah yes, lawonama is right, that's why it probably didn't show the message

And adil, you forgot

new playername[24];
No, I didn't wrote it on purpose because I think he's using GF.
Reply
#10

Quote:
Originally Posted by Adil
Посмотреть сообщение
No, I didn't wrote it on purpose because I think he's using GF.
Im using Regular Script, I just created a SAMP Admin Script
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)