dcmd_10(playerid,params[])
{
new reportid,id;
if(gTeam[playerid]!=TEAM_COP)
{
SendClientMessage(playerid,COLOR_RED,"This Command is only for Law Enforcement!");
return 1;
}
if(reportid > 99 || reportid < 0)
{
SendClientMessage(playerid,COLOR_RED,"Invalid Code!");
return 1;
}
if(HasSendedRadioCode[playerid]>1)
{
SendClientMessage(playerid,COLOR_RED,"Please wait before Sending a Police Code again!");
return 1;
}
if(reportid ==25 || reportid ==75)
{
if(sscanf(params, "du", reportid,id))
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /10 [25/75] [playerid]");
return 1;
}
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid)
{
SendPlayerRadioCrimeCode(playerid,reportid,id);
HasSendedRadioCode[playerid]=15;
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED,"This Player is not connected");
return 1;
}
}
else
{
if(sscanf(params, "d", reportid))
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /10 [0-99]");
return 1;
}
SendPlayerRadioCrimeCode(playerid,reportid,-1);
HasSendedRadioCode[playerid]=15;
}
return 1;
}
You need to use sscanf above the reportid checks or it's just going to be 0 the entire time...
|
dcmd_10(playerid,params[])
{
new reportid,id;
if(gTeam[playerid]!=TEAM_COP)
{
SendClientMessage(playerid,COLOR_RED,"This Command is only for Law Enforcement!");
return 1;
}
if(reportid > 99 || reportid < 0)
{
SendClientMessage(playerid,COLOR_RED,"Invalid Code!");
return 1;
}
if(HasSendedRadioCode[playerid]>0)
{
SendClientMessage(playerid,COLOR_RED,"Please wait before Sending a Police Code again!");
return 1;
}
if(sscanf(params, "du", reportid,id)&& reportid ==25 || sscanf(params, "du", reportid,id)&& reportid ==75)
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /10 [25/75] [playerid]");
return 1;
}
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid)
{
SendPlayerRadioCrimeCode(playerid,reportid,id);
HasSendedRadioCode[playerid]=15;
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED,"This Player is not connected or is yourself");
return 1;
}
if(sscanf(params, "d", reportid)&& reportid !=25 && sscanf(params, "d", reportid)&& reportid !=75)//errorline
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /10 [0-99]");
return 1;
}
SendPlayerRadioCrimeCode(playerid,reportid,-1);
HasSendedRadioCode[playerid]=15;
return 1;
}
acnr_lv2.pwn(27698) : warning 225: unreachable code