20.03.2012, 16:44
I need a timer with a command like /SPAM it sends a message to the player with "You like spam" Until he typer /stopspam :P
new SpamTimer[MAX_PLAYERS];
CMD:spam(playerid, params[])
{
if(SpamTimer[playerid] > 0)
return SendClientMessage(playerid, -1, "You're getting spammed... Use /stopspam to stop it.");
SpamTimer[playerid] = SetTimerEx("SpamPlayer", 1000, true, "i", playerid);
SendClientMessage(playerid, -1, "Spam started. To stop it, use /stopspam.");
return 1;
}
CMD:stopspam(playerid, params[])
{
if(SpamTimer[playerid] == 0)
return SendClientMessage(playerid, -1, "You're not getting spammed yet.... Use /spam to start it.");
KillTimer(SpamTimer[playerid]);
SpamTimer[playerid] = 0;
SendClientMessage(playerid, -1, "Spam stopped. To start it again, use /spam.");
return 1;
}
forward SpamTimer(playerid);
public SpamTimer(playerid)
{
SendClientMessage(playerid, -1, " You like spam.");
}
new CheckLocation[MAX_PLAYERS];
CMD:show(playerid, params[])
{
if(CheckLocation[playerid] > 0)
return SendClientMessage(playerid, -1, "Command activated already.");
CheckLocation[playerid] = SetTimerEx("PlayerLocation", 5000, true, "i", playerid);
SendClientMessage(playerid, -1, "Command activated. Use /stopshow to stop it.");
return 1;
}
CMD:stopshow(playerid, params[])
{
if(CheckLocation[playerid] == 0)
return SendClientMessage(playerid, -1, "Command is not activated. Use /show first.");
KillTimer(CheckLocation[playerid]);
CheckLocation[playerid] = 0;
SendClientMessage(playerid, -1, "Command deactivated. Use /show to activate it again.");
return 1;
}
forward PlayerLocation(playerid);
public PlayerLocation(playerid)
{
new Float: Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new p = 0; p<MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p))
{
DisablePlayerCheckpoint(p);
SetPlayerCheckpoint(p, Pos[0], Pos[1], Pos[2], 1.0);
}
}
}