Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Fuzzy168 on November 05, 2011, 06:59:50 pm

Title: SetTimer help
Post by: Fuzzy168 on November 05, 2011, 06:59:50 pm
Is there anyway to set a timer to a specific person?
Title: Re: SetTimer help
Post by: Force on November 06, 2011, 12:59:58 am
Yes, don't use shitty PAWN.
Title: Re: SetTimer help
Post by: DilsonTB on November 06, 2011, 07:02:43 am
You mean:

 OnplayerCommandText:

[pawn] else if (strcmp(cmd, "freeze", true) == 0) {
      new szMsg[256], plr;
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Jugador Desconocido");
SetTimer("freezel",130000,plr);[/pawn]

Functions near script button:

[pawn]public freeze(plr)
{
TogglePlayerControllable(plr,1);
}

public freeze2(plr)
{
TogglePlayerControllable(plr,1);
}[/pawn]

Its only an example... This isnt TESTED.

Hope it help you.
Title: Re: SetTimer help
Post by: yazeen on November 06, 2011, 07:11:07 am
Fuzzy: squirrel (http://vcmp.liberty-unleashed.co.uk/forum/index.php)

You mean:

 OnplayerCommandText:

[pawn] else if (strcmp(cmd, "freeze", true) == 0) {
      new szMsg[256], plr;
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Jugador Desconocido");
SetTimer("freezel",130000,plr);[/pawn]

Functions near script button:

[pawn]public freeze(plr)
{
TogglePlayerControllable(plr,1);
}

public freeze2(plr)
{
TogglePlayerControllable(plr,1);
}[/pawn]

Its only an example... This isnt TESTED.

Hope it help you.

That doesn't work you are fusing squirrel and pawn scripts.
Timer can only be used as function() not function(something,something.....) etc.
Title: Re: SetTimer help
Post by: omarlin97 on November 08, 2011, 04:00:40 am
Yes OnplayerCommandText:
[pawn] else if (strcmp(cmd, "freeze", true) == 0) {
      new szMsg[256], plr;
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Jugador Desconocido");
SetTimer("freezel",130000,plr);[/pawn]
Good Dilson
Title: Re: SetTimer help
Post by: Fuzzy168 on November 08, 2011, 05:06:38 am
Its not a freeze command but i was actually using it for heal and teleportation commands...

Edit:plr instead of playerid will set it for 1 player right?
Title: Re: SetTimer help
Post by: stormeus on November 08, 2011, 05:37:41 pm
You cannot set a timer to a specific person in Pawn.
Those scripts will not work

When are you going to get it through your thick skulls that trying to do that in Pawn DOES NOT WORK? (http://www.halloweenforum.com/attachments/general-halloween/84325d1314935523-what-did-you-find-buy-today-facepalm.gif)
Title: Re: SetTimer help
Post by: heekz.shadow on November 08, 2011, 05:52:23 pm
I expected stormeus so badly to come with this reply  ::)..


      There are still some ways to make it go through a timer. Like...


[pawn]
enum somenab {
lolwut,
ftw
};

enum anothernab {
wtf,
umad
};

new PlayerCall[somenab][anothernab];


// As example, in function

PlayerCall[lolwut][umad] = 1;[/pawn]


Used in timers

[pawn]
if(PlayerCall[lolwut][umad] == 1)
{
SetWaterLevel(0);
}[/pawn]


One thing to note,

 omarlin is so great, he posts things without even knowing what they mean, just to have a post there, like he said somewhere

Quote
Fuzzy1668 ( not sure if the name is correct ) :
   lol exactly
omarlin97 ( not sure if the name is correct) :
  lol precisely


 Isn't he lovely? ( NO HOMO ! )
 
Title: Re: SetTimer help
Post by: MaDKiLLeR on November 08, 2011, 06:14:02 pm
Fuzzy better use Squirrel (http://vcmp.liberty-unleashed.co.uk/forum/)
Much Easy with many features.
Title: Re: SetTimer help
Post by: BIG[H] on November 08, 2011, 09:38:52 pm
Sup guys , missed me? , banging around here again ... BANG!!!!!!!!!    Fuzzy pawn is a c type language but 3z is much more functions limited in pawn .  Better start squirrel
Title: Re: SetTimer help
Post by: Fuzzy168 on November 09, 2011, 07:20:33 am
My name is clearly on the post..
Quote
not sure if the name is correct
Quote from: MaDKiLLeR
better use Squirrel
Quote from: MaDKiLLeR
many features
Quote from: BIG[H
Better start squirrel
The only reason why I'm stuck with Pawn is because this is the first(In VC:MP but second in Vice City) scripting language I've learn. I've been planning to learn Squirrel but maybe after some time.

EDIT:I still don't get a thing you say shadow..  :-\
Title: Re: SetTimer help
Post by: BIG[H] on November 09, 2011, 09:34:02 am
Pawn can settimers on functions but not on specific player . Shadow had gave the idea to use timers by strings and enums. But that gona make server little too laggy
Title: Re: SetTimer help
Post by: Fuzzy168 on November 09, 2011, 09:36:52 am
How about if I want to make a anti-hack function? I know I can't use playerid, so what I must do?
Title: Re: SetTimer help
Post by: heekz.shadow on November 09, 2011, 10:18:17 am
Oh god, I have to remake this one, AGAIN...

// On the top of the script
[pawn]new PlayerHacking[MAX_PLAYERS];[/pawn]

// In the command/function
Quote
new Float:hp;
if(GetPlayerHealth(playerid,hp) > 100) PlayerHacking[playerid] = 1;

// In the timer
[pawn] new i;
for( i < MAX_PLAYERS; i++ ) {
if(IsPlayerConnected(i)) {
if(PlayerHacking == 1)
{
Ban(i);
}
}
}
[/pawn]



playerid = The player you are pointing at, using the ID
1 / 0 = The sentence is true or false
i = A substitute for playerid. The server is going through all the player slots, checking if someone was hacking...