Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: DEVIL on October 25, 2011, 11:55:00 am

Title: Time in heal
Post by: DEVIL on October 25, 2011, 11:55:00 am
how can i add heal time in heal?
Title: Re: Time in heal
Post by: Nadeem on October 25, 2011, 04:21:00 pm
open ur gamemodes and Search for heal .And put these lines after ur heal cmd
[pawn]else {
             SetTimer("SetHPTime",8000,0);
              pInfo[playerid][TimeHeal] = 1;
              MessagePM(playerid, GREEN,"Wait(put ur time here)5to prevent death evade...");
              }[/pawn]
Title: Re: Time in heal
Post by: yazeen on October 25, 2011, 04:28:02 pm
open ur gamemodes and Search for heal .And put these lines after ur heal cmd
[pawn]else {
             SetTimer("SetHPTime",8000,0);
              pInfo[playerid][TimeHeal] = 1;
              MessagePM(playerid, GREEN,"Wait(put ur time here)5to prevent death evade...");
              }[/pawn]

Epic Failzor! wheres the SetHPTime function?
and MessagePM is madara.inc
Title: Re: Time in heal
Post by: Nadeem on October 25, 2011, 04:39:38 pm
Bro u didnt seen this ?[pawn]SetTimer("SetHPTime",8000,0);[/pawn]
Hp Time 8000 mean 8 sec
Title: Re: Time in heal
Post by: yazeen on October 25, 2011, 04:54:29 pm
Bro u didnt seen this ?[pawn]SetTimer("SetHPTime",8000,0);[/pawn]
Hp Time 8000 mean 8 sec

Search for SetHpTime in the script and you will find it and copy and paste that in here and help him
This mean after 8 seconds that script will be started..
srsly learn scripting hard and then post
Good Luck :)  ;)
Title: Re: Time in heal
Post by: DEVIL on October 26, 2011, 02:00:06 pm
open ur gamemodes and Search for heal .And put these lines after ur heal cmd
[pawn]else {
             SetTimer("SetHPTime",8000,0);
              pInfo[playerid][TimeHeal] = 1;
              MessagePM(playerid, GREEN,"Wait(put ur time here)5to prevent death evade...");
              }[/pawn]
this is not working i got Madara error.
Title: Re: Time in heal
Post by: heekz.shadow on October 26, 2011, 07:25:17 pm
[madbro]OK BRO!? U MAD TO GET TIMEHEAL!? IF YOU MAD THEN !

ON TOPE OF SCRITPE !!!
[pawn]enum pINFE{
TIMEHEAL
};

new UMAD[MAX_PLAYERS][pINFE];[/pawn]

K BRO!?! MORE MADNEESEE!!!? HEREEEE!

[pawn]
if(strcmp(cmdtext, "heal", true) == 0)
{
    SetTimer("MADBRO",5000,0);
    UMAD[playerid][TIMEHEAL] = 1;
    SendClientMessage(playerid,0x0000ff, "UMADBRO?! U WANT HEAL COME FAST? GO /kill YOURSELF OR WAIT 5 SECONDS!");
    return 1;
}[/pawn]


THIS IS MADNESSSSSSSSSSSSSSS!!!

[pawn]
forward MADBRO();
public MADBRO()
{
   new madbros = 0;
   for(madbros < MAX_PLAYERS, madbros++) {
   // UMADBRO!?HEAL FAST ?!?!?!?!?!?!?!?!?!?
   // OKAY! HERE U FUCKIN GO!!!
   if(IsPlayerConnected(madbros)) {
   // MORE MADNESS?!?! BRO U SO MAD :O
   if(UMAD[madbros][TIMEHEAL] == 1)
   {
   // MADBRO!? U RECEIVE 100HP!? UBROMAD!
   SetPlayerHealth(madbros,100);
   SendClientMessage(madbros,0x00000ff,"EAT SHIT AND DIE !!! MAD BRO!? WHY DONT YOU /q!");
   UMAD[madbros][TIMEHEAL] = 0; // GO **** YOURSELF !
   }
   }
   }
   return 1;
   }[/pawn]

THIS IS MADBRO LESSON[/madbro]

 Not tested, dunno if it works. Dinner break nutzers. xOxO ( NO HOMO! )

[joke][madbro] UBRO POST HERE IF WORKS OR NOT! /me WILL FIX IT FOR UR BIG $$$[/madbro][/joke]
Title: Re: Time in heal
Post by: Fuzzy168 on October 27, 2011, 05:27:27 am
lol.. shadow. cool down mate
Title: Re: Time in heal
Post by: Force on October 27, 2011, 04:10:45 pm
That script won't even work... you'll have a million and one timers setting everyones health to 100% if they did !heal so some people could get healed instantly whilst others are waiting just 2 seconds, then the other people waiting 5 seconds.
Title: Re: Time in heal
Post by: heekz.shadow on October 27, 2011, 06:11:50 pm
Bro.. This is what he wanted... You cannot sync timers so good, [ Due to lack of developing and PAWN features (talking about pawn scripts) ]


 And what you say? It won't work? Mate, it's a special function for everyone. 6 guys at a time can do the !heal thing, and it won't be bug... Why are you so mean? I tried to explain a script in a funny way... Now go and blame Stormeus for too much knowledge about C++ ...

 Oh, and by the way. The timer gets killed when the function is done... So...

Now, please

(http://www.lazyboneuk.com/product_images/uploaded_images/C/doormat-anim.gif)
Title: Re: Time in heal
Post by: Force on October 27, 2011, 07:06:16 pm
Bro.. This is what he wanted... You cannot sync timers so good, [ Due to lack of developing and PAWN features (talking about pawn scripts) ]

And what you say? It won't work? Mate, it's a special function for everyone. 6 guys at a time can do the !heal thing, and it won't be bug... Why are you so mean? I tried to explain a script in a funny way... Now go and blame Stormeus for too much knowledge about C++ ...

Oh, and by the way. The timer gets killed when the function is done... So...

It will work just not as intended, say PlayerA did !heal, this would set the 5 second timer, then PlayerB did !heal with 1 second left on the timer. This would mean that when the 5 seconds are up PlayerA would get healed, and PlayerB would also get healed.

Therefore PlayerB has an unfair advantage over PlayerA since he will get healed in a shorter amount of time.

Being mean? I'm telling it how it is, I have far more knowledge than you in scripting so I think it's time you used a proper language rather than this shitty PAWN thing, and yes I have used PAWN for SA:MP and that is a pile of wank, and it works properly.
Title: Re: Time in heal
Post by: stormeus on October 27, 2011, 10:10:14 pm
go and blame Stormeus for too much knowledge about C++ ...
Where do I come into any of this? Ah well, might as well get involved now.

VC:MP Pawn does not support parameters in timers. What you'd have to do is set a timer to go off every second (which will cause srs lag). It would be a better idea to have that timer handle anything that involves timers with parameters.

PlayerInfo[playerid][TimeHeal] would not be set to one. You would use PlayerInfo[playerid][TimeHeal] = time(); Then you'd change your UMAD function to look something like this:

[pawn]
public MADBRO()
{
   new madbros = 0;
   for(madbros < MAX_PLAYERS, madbros++)
   {
      if(IsPlayerConnected(madbros))
      {
         if(UMAD[madbros][TIMEHEAL] != 0 && (time() - UMAD[madbros][TIMEHEAL]) >= 5)
         {
            SetPlayerHealth(madbros,100);
            SendClientMessage(madbros,0x00000ff,"Healed");
            UMAD[madbros][TIMEHEAL] = 0;
         }
      }
   }

   return 1;
}
// lol why u mad tho
[/pawn]

Aside from deleting all those umad comments, a conditional line was changed:
if(UMAD[madbros][TIMEHEAL] > 0 && (time() - UMAD[madbros][TIMEHEAL]) >= 5)

This checks if they're waiting to be healed. Then it sees if the timestamp of when they used the command, taken from the current timestamp (number of seconds since the Unix Epoch. Google it) is at least 5 if something lags or bugs out.

Then it heals them.

Also, you'd have to use SetTimer("MADBRO", 1000, 1); in OnScriptLoad instead of calling the timer every time the command is used, because Force has a point -- your server will have shitloads of timers going off to run the same timer because you used 0 for the number of iterations. Eventually, it'll get to a point where you're healed instantly.

tl;dr
There I fixed it.
Title: Re: Time in heal
Post by: Morphine on October 28, 2011, 11:25:45 am
Blame this legend ^ for owning Shadow.
Title: Re: Time in heal
Post by: DEVIL on October 30, 2011, 01:16:50 pm
i can't get it guys plz give me correct one.
Title: Re: Time in heal
Post by: heekz.shadow on October 31, 2011, 07:21:33 pm
Also, you'd have to use SetTimer("MADBRO", 1000, 1); in OnScriptLoad instead of calling the timer every time the command is used, because Force has a point -- your server will have shitloads of timers going off to run the same timer because you used 0 for the number of iterations. Eventually, it'll get to a point where you're healed instantly.

Too much squirrel ?

 public OnGameModeInit()

 Also, post here the issues / errors and the lines that gave you the errors, please, we are not brain readers...
Title: Re: Time in heal
Post by: Fuzzy168 on October 31, 2011, 08:20:10 pm
its more he does not know what to put because you are givving tooooooooooooooooo much MADNESS..