#1

Hi, i was wondering, how do i make a timer? and how does this work? I want to make one for my CC script.
Reply
#2

What kind of timer you need? What function he need to call?

// https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

Everything you would possibly need can be found here:

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#4

Thanks for this, here is a script i want to make a timer for, its for a cruise control script in my server:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        new Float:vX, Float:vY, Float:vZ;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
        SendClientMessage(playerid, COLOR_ORANGE,"Cruise control has been enabled!");
    }
    return 1;
}
EDIT: i do know how to set a timer for e.g a server announcement, but how do i do it for this script?
Reply
#5

??
Reply
#6

What do you want the timer to do?

Edit: Also this may help https://sampforum.blast.hk/showthread.php?tid=281002
Reply
#7

pawn Код:
new Timer[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        new Float:vX, Float:vY, Float:vZ,vid = GetPlayerVehicleID(playerid);
        GetVehicleVelocity(vid, vX, vY, vZ);
        Timer[playerid] = SetTimerEx("ASDQWE",200,1,"dfff",vid,vX,vY,vZ);
        SendClientMessage(playerid, COLOR_ORANGE,"Cruise control has been enabled!");
    }
    return 1;
}

forward ASDQWE(vehicleid,Float:x,Float:y,Float:z);
public ASDQWE(vehicleid,Float:x,Float:y,Float:z) return SetVehicleVelocity(vehicleid,x,y,z);
Reply
#8

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
new Timer[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_SECONDARY_ATTACK))
    {
        new Float:vX, Float:vY, Float:vZ,vid = GetPlayerVehicleID(playerid);
        GetVehicleVelocity(vid, vX, vY, vZ);
        Timer[playerid] = SetTimerEx("ASDQWE",200,1,"dfff",vid,vX,vY,vZ);
        SendClientMessage(playerid, COLOR_ORANGE,"Cruise control has been enabled!");
    }
    return 1;
}

forward ASDQWE(vehicleid,Float:x,Float:y,Float:z);
public ASDQWE(vehicleid,Float:x,Float:y,Float:z) return SetVehicleVelocity(vehicleid,x,y,z);
Thanks! but where do i put the last 2 lines?

pawn Код:
forward ASDQWE(vehicleid,Float:x,Float:y,Float:z);
public ASDQWE(vehicleid,Float:x,Float:y,Float:z) return SetVehicleVelocity(vehicleid,x,y,z);
Reply
#9

Quote:
Originally Posted by dahley5
Посмотреть сообщение
Thanks! but where do i put the last 2 lines?

pawn Код:
forward ASDQWE(vehicleid,Float:x,Float:y,Float:z);
public ASDQWE(vehicleid,Float:x,Float:y,Float:z) return SetVehicleVelocity(vehicleid,x,y,z);
Whereever you want outside any callback and function.
Reply
#10

ok, thanks
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)