returning a value thats already returned?
#1

okden

i started a vip script

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(Donator[playerid]==1)
    {
        SendClientMessage(playerid,COLOR_RED,"lol");
        return 1;
        }
        return 0;
    }
}
but i get


C:\Users\Desktop\DeathRace0.3b\gamemodes\viptest.p wn(61) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

but it does?

but anyhoo thats that tbf
Reply
#2

You are missing a return for the case, that the command isnt /mycommand. In that case, the if will be skipped, and there will be no return. Add a return 0 in the very last line of the callback, just before the last bracket.
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(Donator[playerid]==1)
        {
            SendClientMessage(playerid,COLOR_RED,"lol");
        }
        return 1;
    }
    return 0;
}
A command must return 1,else it will send you "SERVER: Unknown command." even if the command will affect.
Reply
#4

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(Donator[playerid]==1)
        {
            SendClientMessage(playerid,COLOR_RED,"lol");
        }
        return 1;
    }
    return 0;
}
A command must return 1,else it will send you "SERVER: Unknown command." even if the command will affect.
thanks xst :P

This forum requires that you wait 120 seconds between posts. Please try again in 48 seconds.
fuc sake :l
Reply
#5

No problem,and I am always enjoying seeing people getting pwned and flaming by the anti spam system XD.
Reply
#6

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
No problem,and I am always enjoying seeing people getting pwned and flaming by the anti spam system XD.
lol :P

The message you have entered is too short. Please lengthen your message to at least 8 characters.
This forum requires that you wait 120 seconds between posts. Please try again in 53 seconds.
if i see that shit again ima explode D:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)