PDA

View Full Version : Cmd Return value


Pk93
12/08/2013, 01:10 AM
[SOLVED]

Pk93
12/08/2013, 01:12 AM
[SOLVED]

NinjahZ
12/08/2013, 01:19 AM
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.


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
}

Pk93
12/08/2013, 01:20 AM
ah thanks for taking your time but i already solved it xD

NinjahZ
12/08/2013, 01:22 AM
XD you are welcome.
Good luck scripting!

Pk93
12/08/2013, 03:23 AM
Thanks alot!