[HELP]: Y_timers error
#1

Hello there, so I decided to switch to YSI\y_timers
But every time I try to use it, I get this error
Код:
error 010: invalid function or declaration
I followed all the instructions individually from this thread, but still, I got that error,
thanks in advance

Solution

I just updated YSI library, and Added this
Reply
#2

Can you show me one of your code?
Reply
#3

That's a little example

PHP код:
timer VaultTime[1000](playerid)
{
    
SendClientMessage(playerid0xFF000088"The Vault Door is opening");

Reply
#4

Works fine for me, Maybe it isn't related to y_timers?
Reply
#5

and how did you call the timer? show that line and the code around it too

here's another example of a simple timer copied form one of my older scripts (uses y_commands)
Код:
timer FlashLight[500](vehicleid)//500ms
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
    //now it's done.
}


YCMD:flash(playerid, params[], help)
{
    if(help) return SendClientMessage(playerid, gray, "/flash Is used to \"flash\" the lights of a vehicle.");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;

    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, VEHICLE_PARAMS_ON, doors, bonnet, boot, objective);

    //start the timer
    //we're also passing the vehicleid as a param to the timer
    defer FlashLight(GetPlayerVehicleID(playerid));

    return 1;
}
Reply
#6

Quote:
Originally Posted by CutX
Посмотреть сообщение
and how did you call the timer? show that line and the code around it too

here's another example of a simple timer copied form one of my older scripts (uses y_commands)
Код:
timer FlashLight[500](vehicleid)//500ms
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
    //now it's done.
}


YCMD:flash(playerid, params[], help)
{
    if(help) return SendClientMessage(playerid, gray, "/flash Is used to \"flash\" the lights of a vehicle.");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;

    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, VEHICLE_PARAMS_ON, doors, bonnet, boot, objective);

    //start the timer
    //we're also passing the vehicleid as a param to the timer
    defer FlashLight(GetPlayerVehicleID(playerid));

    return 1;
}
These are the errors I get
Код:
error 010: invalid function or declaration
C:\Users\Oussama\Documents\My pawn projects\Gamemodes\EO_CnR\gamemodes\LS_PX_CNR.pwn(1639) : error 017: undefined symbol "defer"
C:\Users\Oussama\Documents\My pawn projects\Gamemodes\EO_CnR\gamemodes\LS_PX_CNR.pwn(1639) : error 017: undefined symbol "FlashLight"
Reply
#7

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
These are the errors I get
Код:
error 010: invalid function or declaration
C:\Users\Oussama\Documents\My pawn projects\Gamemodes\EO_CnR\gamemodes\LS_PX_CNR.pwn(1639) : error 017: undefined symbol "defer"
C:\Users\Oussama\Documents\My pawn projects\Gamemodes\EO_CnR\gamemodes\LS_PX_CNR.pwn(1639) : error 017: undefined symbol "FlashLight"
no no no, don't get me wrong, i did say "example"
just in case you still needed some since the ones in the main y_timers thread apparently did not suffice

that being said, i still wanna see how you call your timer + code around it



here's a repeat example too, that timer will repeat for a player every 700ms as long as hes driving a vehicle
Код:
new Timer:speedoT[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
		speedoT[playerid] = repeat speedo(playerid);
	return 1;
}

timer speedo[700](playerid)//speedo
{
	if(!IsPlayerInAnyVehicle(playerid))
	{
		stop speedoT[playerid];
		SendClientMessage(playerid, -1, "aaaaaand am out.");
		return 1;
	}
	SendClientMessage(playerid, -1, "inside..");
	return 1;
}
Reply
#8

I haven't made anything with this include yet, so I have no code to show, It's just, when I try to make something, it always display this
Код:
invalid function or declaration
PHP код:
timer speedo[700](playerid)//speedo
{
    
SendClientMessage(playerid, -1"inside..");
    return 
1;

Reply
#9

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
I haven't made anything with this include yet, so I have no code to show, It's just, when I try to make something, it always display this
Код:
invalid function or declaration
PHP код:
timer speedo[700](playerid)//speedo
{
    
SendClientMessage(playerid, -1"inside..");
    return 
1;

//EDIT: NOPE, ignore what i said below, i wasn't thinking hard enough
of course you can write it like that on its own.
so, the line of the error, is it the line where it says "timer ....[...](...)" ?
and if so, what's above it?
and do you have the latest YSI? (here)

----------------------------------------------

ah, yes yes ok.
so that's a completely valid error then.

you gotta call the timer somewhere,
you can't just write the "timer body" somewhere on its own
Reply
#10

Yes the error line is timer speedo[7020](playerid)
what above it? I don't think it matters, because whenever I put the piece of code, it gives the same error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)