[FilterScript] Raimbow Man [Skin change with time]
#2

pawn Код:
//================ Rainbow Man ==========
//======= By Teddy ============
#include <a_samp>
#define COLOR_RED 0xFF0000FF
new CTimer1;
new CTimer2;
new CTimer3;
new CTimer4;
new CTimer5;
forward Color1(playerid);
forward Color2(playerid);
forward Color3(playerid);
forward Color4(playerid);
forward Color5(playerid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Rainbow Skin - by Teddy.        ");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/rainbowman", cmdtext, true, 14) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "Rainbow Man has been turned on.");
            KillTimer(CTimer2);
            KillTimer(CTimer3);
            KillTimer(CTimer4);
            KillTimer(CTimer5);
            CTimer1 = SetTimerEx("Color1", 500, 0, "d" ,playerid);
        }
    }
    if (strcmp("/rainbowmanoff", cmdtext, false, 14) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "Rainbow Man has been turned off.");
            KillTimer(CTimer1);
            KillTimer(CTimer2);
            KillTimer(CTimer3);
            KillTimer(CTimer4);
            KillTimer(CTimer5);
            TogglePlayerControllable(playerid, 1);
        }
    }
}

public Color1(playerid)
{
   KillTimer(CTimer1);
   SetPlayerSkin(playerid, 19);
   CTimer2 = SetTimerEx("Color2", 500, 0, "d" ,playerid);
}

public Color2(playerid)
{
   KillTimer(CTimer2);
   SetPlayerSkin(playerid, 22);
   CTimer3 = SetTimerEx("Color3", 500, 0, "d" ,playerid);
}

public Color3(playerid)
{
   KillTimer(CTimer3);
   SetPlayerSkin(playerid, 84);
   CTimer4 = SetTimerEx("Color4", 500, 0, "d", playerid);
}

public Color4(playerid)
{
   KillTimer(CTimer4);
   SetPlayerSkin(playerid, 115);
   CTimer5 = SetTimerEx("Color5", 500, 0, "d" ,playerid);
}

public Color5(playerid)
{
   KillTimer(CTimer5);
   SetPlayerSkin(playerid, 293);
   SetTimerEx("Color1", 500, 0, "d" ,playerid);
}

public OnFilterScriptExit()
{
    return 1;
}
WHAT is this??

This will not work for more than 1 player as the timer is not supported for MAX_PLAYERS it will only run for 1 player.
The script is bugged and why are you using 6 timers?... it can be made easily with SINGLE timer here i fixed it up for you.
pawn Код:
#include <a_samp>
#define COLOR_RED 0xFF0000FF
new CTimer1[MAX_PLAYERS];

forward Color1(playerid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Rainbow Skin - by Teddy.edited by Littlehelper[MDZ] ");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/rainbowman", cmdtext, true, 14) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "Rainbow Man has been turned on.");
            CTimer1[playerid] = SetTimerEx("Color1", 500, 0, "d" ,playerid);
        }
    }
    if (strcmp("/rainbowmanoff", cmdtext, false, 14) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "Rainbow Man has been turned off.");
            KillTimer(CTimer1[playerid]);
            TogglePlayerControllable(playerid, 1);
        }
    }
}

public Color1(playerid)
{
   new skins = random(5);
   switch(skins) {
    case 0:
   SetPlayerSkin(playerid, 19);
    case 1:
   SetPlayerSkin(playerid, 22);
    case 2:
   SetPlayerSkin(playerid, 84);
    case 3:
   SetPlayerSkin(playerid, 115);
    case 4:
   SetPlayerSkin(playerid, 293);
   }
}
Reply


Messages In This Thread
Raimbow Man [Skin change with time] - by sirvasy - 25.05.2013, 16:47
Re: Raimbow Man [Skin change with time] - by Littlehelper - 25.05.2013, 16:55
Re: Raimbow Man [Skin change with time] - by sirvasy - 25.05.2013, 17:00
Re: Raimbow Man [Skin change with time] - by Abhishek. - 25.05.2013, 17:02
AW: Raimbow Man [Skin change with time] - by ulbi1990 - 25.05.2013, 17:34
Re: Raimbow Man [Skin change with time] - by Littlehelper - 25.05.2013, 18:59
Re: Raimbow Man [Skin change with time] - by BpVanshVk - 25.05.2013, 22:19
Re: Raimbow Man [Skin change with time] - by Deron_Green - 26.05.2013, 20:04
Re: Raimbow Man [Skin change with time] - by Alex Magaсa - 26.05.2013, 20:12
Re: Raimbow Man [Skin change with time] - by sirvasy - 28.05.2013, 20:15

Forum Jump:


Users browsing this thread: 4 Guest(s)