add timer in dialog
#1

hey guys, i'm trying to add a timer in this dialog.

Код:
          case 4:
                {
                    PlayAudioStreamForPlayer(playerid, "http://*******/DeathSound.mp3");
           	    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    	            new Float:X;
                    new Float:Y;
                    new Float:Z;

                    GetPlayerName(playerid, pname, sizeof(pname));
                    format(string, sizeof(string), "%s(%d) is Dying.", pname, playerid);
                    SendClientMessageToAll(0xAAAAAAAA, string);
                    GetPlayerPos(playerid, X, Y, Z);
                    SetPlayerHealth(playerid, 0);
		    format(string, sizeof(string), "%s(%d) has Passed on.", pname, playerid);
		    SendClientMessageToAll(0xAAAAAAAA, string);
        	}
what i am trying to do is make the dialog option play an audiostream when it is selected and also send a message to the server saying: "player is Dying"

and then i want the player to die 2 seconds after the stream starts playing and also display another message to the server saying "player has Passed On"

how would i go about doing this?
Reply
#2

pawn Код:
case 4:
                {
                    PlayAudioStreamForPlayer(playerid, "http://*******/DeathSound.mp3");
                new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
                    new Float:X;
                    new Float:Y;
                    new Float:Z;

                    GetPlayerName(playerid, pname, sizeof(pname));
                    format(string, sizeof(string), "%s(%d) is Dying.", pname, playerid);
                    SendClientMessageToAll(0xAAAAAAAA, string);
                    GetPlayerPos(playerid, X, Y, Z);
                    SetTimerEx("Passed", 2000, 0, "i", player); //Add the Timer 2000 Miliseconds = 2 seconds
                  // SetTimerEx("Callback(in this chase)",miliseconds (1000ms = 1 second), 1 = repeat| 0 = don't repeat, format, playerid (In this chase));
            }

     //Put this in some place of your GM (i recommend in the end) but not insede of any public
        forward Passed(playerid);
    public Passed(playerid)
    {
            new PName[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME+14]; //Define some variables
            GetPlayerName(playerid, PName, sizeof (PName)); //Get the name to "PName"
            format(string, sizeof(string),"%s(%d) has passed on", PName , playerid); //Set the Text to %s == PName == Playername | %d == playerid
        SetPlayerHealth(playerid, 0.0);//Kill player
        SendClientMessageToAll(0xFFFFFF, string); //Send a message to all players
    }
Reply
#3

thank you very much for the help enjoy the rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)