SA-MP Forums Archive
Kick if you do not type the command? - 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: Kick if you do not type the command? (/showthread.php?tid=269989)



Kick if you do not type the command? - Shockey HD - 18.07.2011

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?


Re: Kick if you do not type the command? - grand.Theft.Otto - 18.07.2011

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?


Re: Kick if you do not type the command? - Shockey HD - 18.07.2011

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?


Re: Kick if you do not type the command? - grand.Theft.Otto - 18.07.2011

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 ^


Re: Kick if you do not type the command? - Shockey HD - 18.07.2011

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


Re: Kick if you do not type the command? - Adil - 18.07.2011

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);



Re: Kick if you do not type the command? - lawonama - 18.07.2011

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);



Re: Kick if you do not type the command? - grand.Theft.Otto - 18.07.2011

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

And adil, you forgot

new playername[24];


Re: Kick if you do not type the command? - Adil - 18.07.2011

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.


Re: Kick if you do not type the command? - Shockey HD - 18.07.2011

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