Need help.
#1

I have a command if i type /class and select Invincible,Then it activates invincible and if you press JUMP_KEy it makes you invincible for 7 seconds.I have made a timer so that it can be only used once 50 seconds here are my code.
on top
pawn Код:
new IsInvincible[MAX_PLAYERS];
new ClassSelectedInvin[MAX_PLAYERS];
new ClassTimerInvinVar;
OnPlayerSpawn
pawn Код:
IsInvincible[playerid] = 0;
             ClassSelectedInvin[playerid] = 0;
Under OnPlayerKeyStateChange
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_JUMP)
    {
        IsInvincible[playerid] = 0;
        SetPlayerHealth(playerid,99999);
        SetTimerEx("Invincible",7000,0, "i", playerid);
and here the forward'
pawn Код:
forward ClassTimerInvin(playerid);
public ClassTimerInvin(playerid)
{
    ClassSelectedInvin[playerid] = 0;
    KillTimer(ClassTimerInvinVar);
    return 1;
}
forward Invincible(playerid);
public Invincible(playerid)
{
    if(IsInvincible[playerid] == 0) return IsInvincible[playerid] = 1;
    SetPlayerHealth(playerid,50);
    SendClientMessage(playerid,-1,"You are now Un-Invincible");
    return 1;
and here's my Dialog
pawn Код:
if(dialogid == 4)
        {
            if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if(IsInvincible[playerid] == 1)
                        {
                            SendClientMessage(playerid,-1,"You need to wait 50 Secods before using this class again");
                        }
                        else if(IsInvincible[playerid] == 0)
                        {
                            IsInvincible[playerid] = 1;
                            ClassSelectedInvin[playerid] = 1;
                            SendClientMessage(playerid, -1, "Invincible Class Activated");
                            SendClientMessage(playerid,-1, "Press Jump_Key To Activated Invincible Mode");
                            ClassTimerInvinVar = SetTimer("ClassTimerInvin",50000,false);
                        }
                    }

}
i really need it ...
no errors
Will +Rep if you want.
Reply


Messages In This Thread
Need help. - by Rudy_ - 21.06.2012, 13:52
Re: Need help. - by nilanjay - 21.06.2012, 14:00
Re: Need help. - by vIBIENNYx - 21.06.2012, 14:01
Re: Need help. - by Rudy_ - 21.06.2012, 14:02
Re: Need help. - by nilanjay - 21.06.2012, 14:06
Re: Need help. - by vIBIENNYx - 21.06.2012, 14:19
Re: Need help. - by Rudy_ - 21.06.2012, 14:24
Re: Need help. - by nilanjay - 21.06.2012, 14:26
Re: Need help. - by Rudy_ - 21.06.2012, 14:30
Re: Need help. - by vIBIENNYx - 21.06.2012, 14:45

Forum Jump:


Users browsing this thread: 1 Guest(s)