Warning that I don't know how to fix
#1

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)