Author Topic: SetTimer help  (Read 4327 times)

0 Members and 1 Guest are viewing this topic.

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
SetTimer help
« on: November 05, 2011, 06:59:50 pm »
Is there anyway to set a timer to a specific person?
I'm beginning to feel like a Lag God, Lag God

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: SetTimer help
« Reply #1 on: November 06, 2011, 12:59:58 am »
Yes, don't use shitty PAWN.

Offline DilsonTB

  • Made Man
  • ***
  • Posts: 140
  • VC:MP Developer. & SA:MP Currently Developer
    • View Profile
Re: SetTimer help
« Reply #2 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.
_______________________________________________
¬ VC:MP Squirrel Developer.
¬ VC:MP pawno Developer.
¬ SA:MP Developer.
¬
¬ Actually developing " San Fierro Roleplay - Latino ", with
my beta team testers, Mapper + Scripter ( me ), 18,000
lines, and is 34% finished. hope to finish it in 4 Or 3 Months.

- MYSQL FULL BASED.
- PCU.
_______________________________________________

yazeen

  • Guest
Re: SetTimer help
« Reply #3 on: November 06, 2011, 07:11:07 am »
Fuzzy: squirrel

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.

Offline omarlin97

  • Street Thug
  • *
  • Posts: 41
  • Scripter The Server Pawno
    • View Profile
    • Dominican Server Latino
Re: SetTimer help
« Reply #4 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
Owner end creator the Server TDM

Dominican Server Latino
web site: http://dominicanserver.net16.net/

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: SetTimer help
« Reply #5 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?
« Last Edit: November 08, 2011, 07:01:47 am by Fuzzy168 »
I'm beginning to feel like a Lag God, Lag God

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: SetTimer help
« Reply #6 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?
« Last Edit: November 08, 2011, 05:40:35 pm by stormeus »
Do not PM me for support.




Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: SetTimer help
« Reply #7 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 ! )
 
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players

Offline MaDKiLLeR

  • Wiseguy
  • **
  • Posts: 51
  • Pawn / Squirrel / PHP / HTML
    • View Profile
    • Humza Khan
Re: SetTimer help
« Reply #8 on: November 08, 2011, 06:14:02 pm »
Fuzzy better use Squirrel
Much Easy with many features.
- [VU_R]MaDKiLLeR

~ Site | Projects | IRC ~


Offline BIG[H]

  • Made Man
  • ***
  • Posts: 159
  • Sight of light
    • View Profile
Re: SetTimer help
« Reply #9 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
Outdoor city server Administrator, FS server owner!

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: SetTimer help
« Reply #10 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..  :-\
« Last Edit: November 09, 2011, 07:25:57 am by Fuzzy168 »
I'm beginning to feel like a Lag God, Lag God

Offline BIG[H]

  • Made Man
  • ***
  • Posts: 159
  • Sight of light
    • View Profile
Re: SetTimer help
« Reply #11 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
Outdoor city server Administrator, FS server owner!

Offline Fuzzy168

  • VC:MP Veteran
  • *****
  • Posts: 729
  • Programming since 2011
    • View Profile
Re: SetTimer help
« Reply #12 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?
I'm beginning to feel like a Lag God, Lag God

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: SetTimer help
« Reply #13 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...




« Last Edit: November 09, 2011, 10:21:27 am by heekz.shadow »
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players