25.05.2013, 17:34
Faster and simpler, also not a new idea!
You have to much useless Code in this Script. Starting many Timers != great for server performance. Also is Littlehelper[MDZ] correct. It would work only for one person.
pawn Код:
include <a_samp>
new TimerOn[MAX_PLAYERS],Timer[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/rainbowman", cmdtext, true, 14) == 0)
{
if(TimerOn[playerid]==0)
{
SendClientMessage(playerid,-1, "Rainbow Man has been turned on.");
Timer[playerid] = SetTimerEx("Skin", 1000, 0, "d" ,playerid);
TimerOn[playerid]=1;
}
else
{
SendClientMessage(playerid,-1, "Rainbow Man has been turned off.");
KillTimer(Timer[playerid]);
TimerOn[playerid]=0;
}
}
return 0;
}
forward Skin(playerid);
public Skin(playerid)
{
SetPlayerSkin(playerid,random(299));
TogglePlayerControllable(playerid,1); //Otherwise it will freeze and bug you!
return 1;
}