SA-MP Forums Archive
Warning that I don't know how to fix - 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: Warning that I don't know how to fix (/showthread.php?tid=283217)



Warning that I don't know how to fix - rangerxxll - 14.09.2011

I'm not really sure whats wrong, but here's my code
pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1827.8311,-1075.7113,23.9317))
    {
        if(simplejobrunning[playerid] == 1)
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
            return 1;
        }
    }
}
And here's my warning
Код:
warning 209: function "cmd_delivery" should return a value
Any help would be appreciated, thanks.


Re: Warning that I don't know how to fix - [HiC]TheKiller - 14.09.2011

pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1827.8311,-1075.7113,23.9317))
    {
        if(simplejobrunning[playerid] == 1)
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        }
    }
    return 1;
}
There you go .


Re: Warning that I don't know how to fix - rangerxxll - 14.09.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1827.8311,-1075.7113,23.9317))
    {
        if(simplejobrunning[playerid] == 1)
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        }
    }
    return 1;
}
There you go .
Can you explain to me why
pawn Код:
return 1;
Has to go there? I'm just curious so I don't make mistakes in the future


Re: Warning that I don't know how to fix - Dr - 14.09.2011

https://sampwiki.blast.hk/wiki/Scripting_Basics#Calls


Re: Warning that I don't know how to fix - Kush - 14.09.2011

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Can you explain to me why
pawn Код:
return 1;
Has to go there? I'm just curious so I don't make mistakes in the future
Returning the value after the compound function is enclosed with braces the command returns that specific value. Returning the value '1' in your first example, returned if(simplejobrunning[playerid] == 1) as true. Though, after the command has been enclosed, everything is being returned.