Taze problem timer
#1

I want my target to taze for 5 seconds and I need a timer right, how?

pawn Код:
dcmd_taze(playerid, params[])
{
    if(AccInfo[playerid][pVip] >= 1)
    {
        new targetid, string[128];
        new playername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerName(targetid, targetname, sizeof(targetname));

        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, white, "{FFFF00}Usage: /taze [PlayerID]");
        else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, white, "{FF0000}>> Invalid Player ID");
        else if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You must step out the vehicle to use your tazer");
        else if(GetPVarInt(playerid, "Jailed") == 1) return GameTextForPlayer(playerid,"Player is Jailed",2000,3);
        else if(Tazed[targetid] == 1)
        {
            format(string, sizeof(string), "{FF0000}>> %s(%d) is being tazed right now", targetname, targetid);
            SendClientMessage(playerid, white, string);
        }
        else if(IsPlayerInAnyVehicle(targetid))
        {
            format(string, sizeof(string), "{FF0000}>> %s(%d) is in a vehicle", targetname, targetid);
            SendClientMessage(playerid, white, string);
            return 1;
        }
        else if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, white, "{FF0000}>> You cannot taze a player from inside a vehicle");
            return 1;
        }
        else
        {
            Tazed[targetid] =1;
            TogglePlayerControllable(targetid, 0);

            ApplyAnimation(targetid,"CRACK","crckdeth2",4.1,1,1,1,1,1);
            return 1;
        }
    }
    else return ErrorMessages(playerid, 1);
    return 1;
}
Reply
#2

add this on top of your script
Код:
forward t_unTaze(playerid); // timer for untaze
add this with your other timers...
Код:
public t_unTaze(playerid)
{
   if(Tazed[playerid] == 1)
  {
      ClearAnimations(playerid);

      TogglePlayerControllable(playerid, 1);
      Tazed[playerid] = 0;
      SendClinetMessage(playerid ,COLOR ,"You regain muscle control!");
   }
   return 1;
}
Change this
Код:
Tazed[targetid] =1;
TogglePlayerControllable(targetid, 0);
ApplyAnimation(targetid,"CRACK","crckdeth2",4.1,1,1,1,1,1); // this is added
SetTimerEx("t_unTaze" ,5000 ,false ,"i" ,targetid);
return 1;
Reply
#3

Quote:
Originally Posted by detter
Посмотреть сообщение
add this on top of your script
Код:
forward t_unTaze(playerid); // timer for untaze
add this with your other timers...
Код:
public t_unTaze(playerid)
{
   if(Tazed[playerid] == 1)
  {
      ClearAnimations(playerid);

      TogglePlayerControllable(playerid, 1);
      Tazed[playerid] = 0;
      SendClinetMessage(playerid ,COLOR ,"You regain muscles control!");
   }
   return 1;
}
Change this
Код:
Tazed[targetid] =1;
TogglePlayerControllable(targetid, 0);
ApplyAnimation(targetid,"CRACK","crckdeth2",4.1,1,1,1,1,1); // this is added
SetTimerEx("t_unTaze" ,5000 ,false ,"i" ,targetid);
return 1;
Testing 1,2,3. Wow yes it works man. thanks But I need to press Space before it clear its animation.
But I could see that it has already ClearAnimations(playerid); Also I could use WASD key to move his body in one spot while his being CRACK.
Reply
#4

Try replacing ClearAnimation with this

Код:
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
Reply
#5

Quote:
Originally Posted by detter
Посмотреть сообщение
Try replacing ClearAnimation with this

Код:
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
Still no work man. Hmmm, What could be the problem? Anyway why not Setplayeranimation to idle or standing position is that possible? XD
Reply
#6

yes it could work ,that was my 1st idea but i didn't want search for anime xd
Reply
#7

Quote:
Originally Posted by detter
Посмотреть сообщение
yes it could work ,that was my 1st idea but i didn't want search for anime xd
Cool bro XD. Can't give you rep right now. Must spread -_-. A Thanks should do :3

EDIT: I should try SPECIAL_ACTION_DRUNK so he would look like his been abused by tazing.
Reply
#8

NO! I demand rep+!!


Just kidding ,glad that i could help
Reply
#9

Quote:
Originally Posted by detter
Посмотреть сообщение
NO! I demand rep+!!


Just kidding ,glad that i could help
*Yao-ming Face. It also didn't work. Hopefully someone solve this. Okay man
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)