Command does not recognize ID and only returns pre-defined error messages (sscanf)
#1

Hello Everyone, The two commands have the same problem
They do not recognize the ID Parameter and always returns the error message that we established.

PHP код:
dcmd_infobtl(playerid,params[])
{
    new 
id,pName[MAX_PLAYER_NAME],stringa[128],stringb[128],stringc[128];
    
    if(
sscanf(params"u"id))
        return 
SendClientMessage(playerid, -1"Informe um ID/NOME vбlido!"); //Only returns this message
    
GetPlayerName(idpNameMAX_PLAYER_NAME);
    if(
Player[id][pEXC] >=|| Player[id][pFEDERAL] >= || Player[id][pBOPE] >= || Player[id][pPMRJ] >= || Player[id][pCORE] >= 8)
    {
        
SendClientMessage(playeridCOR_ADA" » ------------------------------------------------------------------------------------ «");
        
format(stringa,sizeof(stringa),"{00FF00}*** Informaзхes policiais de %s ***",pName);
        
SendClientMessage(playerid,COR_PRINCIPAL,stringa);
        
format(stringb,sizeof(stringb),"{FFFFFF}*** Quantidade de Su's efetuados [%d] ***",Player[id][sutotal]);
        
SendClientMessage(playerid,COR_PRINCIPAL,stringb);
        
format(stringc,sizeof(stringc),"{FFFFFF}*** Total de Suspeitos abatidos [%d] ***",Player[id][suabatidos]);
        
SendClientMessage(playerid,COR_PRINCIPAL,stringc);
        
SendClientMessage(playeridCOR_ADA" » ------------------------------------------------------------------------------------ «");
    }
    else
    {
        
format(stringa,sizeof(stringa),"{00FF00}%s nгo й um Policial!",pName);
        
SendClientMessage(playerid,COR_PRINCIPAL,stringa);
    }
    return 
1;

PHP код:
dcmd_rdrogas(playeridparams[])
{
    if(!
IsPM(playerid1))
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo tem permissгo para usar este comando!");
    if(
EmTrabalho[playerid] == 0)
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб em trabalho!");
    new 
id;
    if(
sscanf(params"u"id))
        return 
SendClientMessage(playerid, -1"Informe um ID vбlido!"); //Only returns this message
    
    
if(!IsPlayerConnected(id))
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Este jogador nгo estб conectado.");
    if (
ProxDetectorS(5.0playeridid))
    {
        if(
Player[playerid][pCORE] >= 5TotalMaconhaApreendida[1] += Player[id][pMaconha];
        else if(
Player[playerid][pEXC] >= 5TotalMaconhaApreendida[2] += Player[id][pMaconha];
        else if(
Player[playerid][pBOPE] >= 5TotalMaconhaApreendida[3] += Player[id][pMaconha];
        else if(
Player[playerid][pPMRJ] >= 5TotalMaconhaApreendida[4] += Player[id][pMaconha];
        else if(
Player[playerid][pFEDERAL] >= 5TotalMaconhaApreendida[4] += Player[id][pMaconha];
        if(
Player[playerid][pCORE] >= 5TotalCocainaApreendida[1] += Player[id][pCocaina];
        else if(
Player[playerid][pEXC] >= 5TotalCocainaApreendida[2] += Player[id][pCocaina];
        else if(
Player[playerid][pBOPE] >= 5TotalCocainaApreendida[3] += Player[id][pCocaina];
        else if(
Player[playerid][pPMRJ] >= 5TotalCocainaApreendida[4] += Player[id][pCocaina];
        else if(
Player[playerid][pFEDERAL] >= 5TotalCocainaApreendida[4] += Player[id][pCocaina];
        if(
Player[playerid][pCORE] >= 5TotalLancaApreendida[1] += Player[id][pLanca];
        else if(
Player[playerid][pEXC] >= 5TotalLancaApreendida[2] += Player[id][pCocaina];
        else if(
Player[playerid][pBOPE] >= 5TotalLancaApreendida[3] += Player[id][pLanca];
        else if(
Player[playerid][pPMRJ] >= 5TotalLancaApreendida[4] += Player[id][pLanca];
        else if(
Player[playerid][pFEDERAL] >= 5TotalLancaApreendida[4] += Player[id][pLanca];
        
Player[id][pMaconha] = 0;
        
Player[id][pCocaina] = 0;
        
Player[id][pLanca] = 0;
        
SendFormattedMessage(idCOR_INFO"{535353}INFO: O polнcial %s retirou suas drogas."getPName(playerid) );
        
SendFormattedMessage(playeridCOR_INFO"{535353}INFO: Vocк retirou as drogas de %s."getPName(id) );
        
SalvarDadosOrgsCops();
    }
    return 
1;

I honestly do not know what the problem
Reply
#2

An example of my unmute command should give you hints.

Код:
CMD:unmute(playerid, params[])
{
        if(pData[playerid][Admin] >= 3)
        {
                new id, str[128];
                if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_CMY,"Usage: /mute <playerid>");
                if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_CMY,"target is not connected");
                if(pMuted[id] == false) return SendClientMessage(playerid, COLOR_RED,"Player is not muted ");

                pMuted[id] = false;

                format(str, sizeof(str),"Admin %s (ID:%d) has unmuted %s (ID:%d)",GetName(playerid), playerid, GetName(id), id);
                SendClientMessageToAll(COLOR_RED, str);
        }
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)