return with two textdraws?
#1

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(playeridPlayerData[playerid][pTextdraws][83]); PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][84]);

Quote:

return PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][83]); PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][84]);

Where I'm wrong with this code ? ^
Reply
#2

PHP код:
forward HideInfoBox(playerid);
public 
HideInfoBox(playerid
{

    if (!
PlayerData[playerid][pShowInfoBox])
        return 
0;
    
PlayerData[playerid][pShowInfoBox] = false;
    
    return 
        
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][83]),
        
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][84]);

You used ';' instead of ',' after first textdrawhide.
Reply
#3

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;
}
Reply
#4

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 "
Reply
#5

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)
Reply
#6

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
Reply
#7

PHP код:
forward HideInfoBox(playerid);

public 
HideInfoBox(playerid){

    if(!
PlayerData[playerid][pShowInfoBox]) return 0;
    
PlayerData[playerid][pShowInfoBox] = false;
    
    
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][83]);
    
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][84]);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)