return with two textdraws? - 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: return with two textdraws? (
/showthread.php?tid=593833)
return with two textdraws? -
DemME - 10.11.2015
Hey guys, so probably I'm trying to build a infobox, now at the bottom I'm trying to put both of the textdraw at the same line -
PHP код:
forward HideInfoBox(playerid);
public HideInfoBox(playerid) {
if (!PlayerData[playerid][pShowInfoBox])
return 0;
PlayerData[playerid][pShowInfoBox] = false;
return PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]); PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);
}
Quote:
return PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]); PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);
|
Where I'm wrong with this code ? ^
Re: return with two textdraws? -
iKarim - 10.11.2015
PHP код:
forward HideInfoBox(playerid);
public HideInfoBox(playerid)
{
if (!PlayerData[playerid][pShowInfoBox])
return 0;
PlayerData[playerid][pShowInfoBox] = false;
return
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]),
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);
}
You used ';' instead of ',' after first textdrawhide.
Re: return with two textdraws? -
Mauzen - 10.11.2015
PlayerTextDrawHide does not return anything interesting. You dont need to put that in the return statement.
pawn Код:
forward HideInfoBox(playerid);
public HideInfoBox(playerid) {
if (!PlayerData[playerid][pShowInfoBox])
return 0;
PlayerData[playerid][pShowInfoBox] = false;
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]);
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);
return;
}
Re: return with two textdraws? -
DemME - 10.11.2015
Quote:
Originally Posted by Mauzen
PlayerTextDrawHide does not return anything interesting. You dont need to put that in the return statement.
pawn Код:
forward HideInfoBox(playerid); public HideInfoBox(playerid) {
if (!PlayerData[playerid][pShowInfoBox]) return 0;
PlayerData[playerid][pShowInfoBox] = false; PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]); PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]); return; }
|
Works, but there is a warning " warning 209: function "HideInfoBox" should return a value "
Re: return with two textdraws? -
Mauzen - 10.11.2015
Right, forgot that. Either remove the 0 from the upper return if you dont use the return value at all, or add a 1 to the bottom return (or anything else you need there)
Re: return with two textdraws? -
PrO.GameR - 10.11.2015
return 1; then, because you are using a return 0;
you can also use true or false if you are only returning it's success
Re: return with two textdraws? -
AbyssMorgan - 10.11.2015
PHP код:
forward HideInfoBox(playerid);
public HideInfoBox(playerid){
if(!PlayerData[playerid][pShowInfoBox]) return 0;
PlayerData[playerid][pShowInfoBox] = false;
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]);
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);
return 1;
}