Suspect CMD - Report to cops radio bug
#1

pawn Код:
dcmd_suspect(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[128];
    if(sscanf(params, "us[100]", ID, cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /suspect (Player Name/ID) (Reason)");
        return 1;
    }
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can report criminals on the police radio.");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot report them",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(gTeam[ID] == COP|| gTeam[ID] == SWAT || gTeam[ID] == FBI || gTeam[ID] == ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot report other law enforcement on the police radio. Im sure they done nothing wrong.");
        return 1;
    }
    if(playerid == ID)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot report yourself down the police radio. Why would you even want to do that.");
        return 1;
 }
    new message =strval(cmdreason);
    new copmsg[250];
    format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),ID,message);
    SendRadioMessageToCops(copmsg);
    format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,message);
    SendClientMessage(ID,COLOR_ROYALBLUE,string);
    IncreaseWantedLevel(ID,1);
    IncreasePlayerScore(playerid,1);
    return 1;
}
Hey guys, I have a suspect cmd, this is part of the codes. I have with this suspect cmd, when I try to suspect a civilian, the reason doesn't show. For example ''/suspect 0 spanking in the public''. the reason doesn't show..
This one doesn't show too, not just reason, but all of the message. No texts, just blank message.
[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s

[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,message);
This one, it works, but reason is not showing.

However wanted levels is working fine, except the message.

Please help me, thanks!
Reply
#2

Change this line:

pawn Код:
format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),ID,message);
    SendRadioMessageToCops(copmsg);
    format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,message);
To this:

pawn Код:
format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
    SendRadioMessageToCops(copmsg);
    format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,cmdreason);
EDIT: I was on my phone so I was lazy to do the whole thing but I've fixed it up, let me know if it works

pawn Код:
dcmd_suspect(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[128];
    if(sscanf(params, "us[128]", ID, cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /suspect (Player Name/ID) (Reason)");
        return 1;
    }
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can report criminals on the police radio.");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot report them",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(gTeam[ID] == COP|| gTeam[ID] == SWAT || gTeam[ID] == FBI || gTeam[ID] == ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot report other law enforcement on the police radio. I'm sure they done nothing wrong.");
        return 1;
    }
    if(playerid == ID)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot report yourself down the police radio. Why would you even want to do that.");
        return 1;
 }
    format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
    SendRadioMessageToCops(string);
    format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,cmdreason);
    SendClientMessage(ID,COLOR_ROYALBLUE,string);
    IncreaseWantedLevel(ID,1);
    IncreasePlayerScore(playerid,1);
    return 1;
}
Reply
#3

variable message isn't string, and you are trying to get value from cmdreason. You can use cmdreason instead or just change new message to new message[128]; and delete message = strval...
Reply
#4

i think that can help :
Quote:

dcmd_suspect(playerid,params[])
{
new string[128];
new ID;
new cmdreason[128];
if(sscanf(params, "us[100]", ID, cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /suspect (Player Name/ID) (Reason)");
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You have been frozen by a Server Administrator. You cannot use this command.");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can report criminals on the police radio.");
return 1;
}
if(InAdminMode[ID] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command on this player because they are in Administrator mode.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot report them",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(gTeam[ID] == TEAM_COP || gTeam[ID] == TEAM_ARMY || gTeam[ID] == TEAM_CIA)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot report other law enforcement on the police radio. Im sure they done nothing wrong.");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot report yourself down the police radio. Why would you even want to do that.");
return 1;
}
if(HasBeenReportedRecently[ID] >= 1)
{
format(string,sizeof(string),"%s(%d) has been reported for criminal activity lately. You cannot report them",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
new message =strval(cmdreason);
format(string,sizeof(string),"[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID),I D,message);
SendClientMessageToAllCops(string);
format(string,sizeof(string),"12[POLICE RADIO] Law Enforcement Officer %s(%d) has reported %s(%d) for criminal activity. Reason: %s",PlayerName(playerid),playerid,PlayerName(ID), ID,message);
IRC_GroupSay(gGroupAdminID,IRC_CHANNEL,string);

format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has reported you. Reason: %s",PlayerName(playerid),playerid,message);
SendClientMessage(ID,COLOR_DODGERBLUE,string);
TextDrawSetString(MessageTD[ID],"TICKET RECIEVED");
TextDrawShowForPlayer(ID,MessageTD[ID]);
MessageTDTime[ID] =5;
IncreaseWantedLevel(ID,2);
HasBeenReportedRecently[ID] =60;
IncreasePlayerScore(playerid,1);
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)