SA-MP Forums Archive
Fuction doesn't work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Fuction doesn't work (/showthread.php?tid=565365)



Fuction doesn't work - CoR3 - 27.02.2015

Hey! hello guys, i have a problem with my second fuction; the textdrawn never hide, and toggleplayercontrollable doesnґt switch. (fuction "TerminoCargarObjetos" never work.)

PHP код:
public CargarObjetos(playerid);
CargarObjetos(playerid)
{
    
TogglePlayerControllable(playerid0);
    
TextDrawShowForPlayer(playeridCARGAOBJ0);
    
TextDrawShowForPlayer(playeridCARGAOBJ1);
     
SetTimer("TerminoCargarObjetos"3500false);
    return 
1;
}
public 
TerminoCargarObjetos(playerid);
TerminoCargarObjetos(playerid)
{
    
TogglePlayerControllable(playerid1);
    
TextDrawHideForPlayer(playeridCARGAOBJ0);
    
TextDrawHideForPlayer(playeridCARGAOBJ1);
    return 
1;

what's my error?


Re: Fuction doesn't work - Glenn332 - 27.02.2015

If it doesnt go to
public TerminoCargarObjetos(playerid);
Then there is something wrong with your settimer.

*Edit

Try and use SetTimerEx("TerminoCargarObjetos", 3500, false, "i", playerid);


Re: Fuction doesn't work - Schneider - 27.02.2015

If you want to pass a value to a function (in this case the playerid) you have to use SetTimerEx

pawn Код:
SetTimerEx("TerminoCargarObjetos", 3500, false, "u", playerid);



Re: Fuction doesn't work - CoR3 - 27.02.2015

Nope, doesnґt work.


Re: Fuction doesn't work - Glenn332 - 27.02.2015

Quote:
Originally Posted by CoR3
Посмотреть сообщение
Nope, doesnґt work.
You tried mine or his?


Re: Fuction doesn't work - Crayder - 27.02.2015

pawn Код:
forward CargarObjetos(playerid);
public CargarObjetos(playerid)
{
    TogglePlayerControllable(playerid, 0);
    TextDrawShowForPlayer(playerid, CARGAOBJ0);
    TextDrawShowForPlayer(playerid, CARGAOBJ1);
     SetTimer("TerminoCargarObjetos", 3500, false);
    return 1;
}
forward TerminoCargarObjetos(playerid);
public TerminoCargarObjetos(playerid)
{
    TogglePlayerControllable(playerid, 1);
    TextDrawHideForPlayer(playerid, CARGAOBJ0);
    TextDrawHideForPlayer(playerid, CARGAOBJ1);
    return 1;
}

On a side note, what does CoR stand for? I used to have a community called 'Call of Rebellion', so I was interested in your name.


Re: Fuction doesn't work - CoR3 - 27.02.2015

Quote:
Originally Posted by Glenn332
Посмотреть сообщение
If it doesnt go to
public TerminoCargarObjetos(playerid);
Then there is something wrong with your settimer.

*Edit

Try and use SetTimerEx("TerminoCargarObjetos", 3500, false, "i", playerid);
Quote:
Originally Posted by Schneider
Посмотреть сообщение
If you want to pass a value to a function (in this case the playerid) you have to use SetTimerEx

pawn Код:
SetTimerEx("TerminoCargarObjetos", 3500, false, "u", playerid);
Quote:
Originally Posted by Crayder
Посмотреть сообщение
pawn Код:
forward CargarObjetos(playerid);
public CargarObjetos(playerid)
{
    TogglePlayerControllable(playerid, 0);
    TextDrawShowForPlayer(playerid, CARGAOBJ0);
    TextDrawShowForPlayer(playerid, CARGAOBJ1);
     SetTimer("TerminoCargarObjetos", 3500, false);
    return 1;
}
forward TerminoCargarObjetos(playerid);
public TerminoCargarObjetos(playerid)
{
    TogglePlayerControllable(playerid, 1);
    TextDrawHideForPlayer(playerid, CARGAOBJ0);
    TextDrawHideForPlayer(playerid, CARGAOBJ1);
    return 1;
}

On a side note, what does CoR stand for? I used to have a community called 'Call of Rebellion', so I was interested in your name.
No brother my name dont have relation with "Call of Rebellion"...

I found this include, it helped me; thanks for your helps
https://sampforum.blast.hk/showthread.php?tid=257826