Cmd Return value
#1

[SOLVED]
Reply
#2

[SOLVED]
Reply
#3

Save a backup of your code incase this does not work but try replacing your code with what I just made,your brackets were not placed at each if statement and you needed to return a value after the if statements aswell.

pawn Код:
CMD:news(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] != NEWS)
    {
        SCM(playerid, COLOR_LIGHTRED,"Invalid faction");
    }
    new string[128];
    if(shutdown == 1)
    {
        SCM(playerid, COLOR_WHITE, "The news system is currently shut down.");
    }
    if(!isAdminDuty(playerid))
    {
        SCM(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin.");
    }
    if(isnull(params))
    {
        SCM(playerid, COLOR_WHITE, "USAGE: /news [text]");
    }
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsACopCar(vehicleid))
    {
        if(PlayerInfo[playerid][pRank] < 1)
        {
            SCM(playerid, COLOR_GRAD2, "You must be at least rank 1.");
        }
        else
        {
            format(string, sizeof(string), "News Radio %s: %s", GetPlayerNameEx(playerid), params);
            ICNews(COLOR_LIGHTGREEN,string);
        }
        else
        {
            SCM(playerid, COLOR_GREY, "You're not in a news van or a news chopper.");
        }
        return 1;//You need to return a value here because there are if statements here
    }
    else
    {
        SCM(playerid, COLOR_GREY, "You are not a News Reporter!");
    }
    return 1; //we need to return a value here aswell for the if statements on this line too
}
Reply
#4

ah thanks for taking your time but i already solved it xD
Reply
#5

XD you are welcome.
Good luck scripting!
Reply
#6

Thanks alot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)