Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Unix timestamp
- forward Update();
- public OnGameModeInit()
- {
- SetTimer("Update", 2000, true);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "Kick", gettime()+30);
- return 1;
- }
- public Update()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(GetPVarInt(i, "Kick") <= gettime() && GetPVarInt(i, "Kick") != 0)
- {
- SetPVarInt(i, "Kick", 0);
- Kick(i);
- }
- }
- return 1;
- }
- public OnDialogResponse(dialogid)
- {
- if(dialogid == DIALOG_LOGIN)
- {
- // If managed to login successfully.
- SetPVarInt(playerid, "Kick", 0);
- }
- }
- // ======================================= Another example of anti spam
- OnPlayerText(playerid, text[])
- {
- if(GetPVarInt(playerid, "CantTalk") < gettime())
- {
- SendClientMessage(playerid, -1, "Don't spam");
- return 0;
- }
- SetPVarInt(playerid, "CantTalk", gettime()+2);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment