Command does not recognize ID and only returns pre-defined error messages (sscanf) -
MarllonGTA - 25.11.2015
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(id, pName, MAX_PLAYER_NAME);
if(Player[id][pEXC] >=8 || Player[id][pFEDERAL] >= 8 || Player[id][pBOPE] >= 8 || Player[id][pPMRJ] >= 8 || Player[id][pCORE] >= 8)
{
SendClientMessage(playerid, COR_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(playerid, COR_ADA, " » ------------------------------------------------------------------------------------ «");
}
else
{
format(stringa,sizeof(stringa),"{00FF00}%s nгo й um Policial!",pName);
SendClientMessage(playerid,COR_PRINCIPAL,stringa);
}
return 1;
}
PHP код:
dcmd_rdrogas(playerid, params[])
{
if(!IsPM(playerid, 1))
return SendClientMessage(playerid, COR_ERRO, "ERRO: Vocк nгo tem permissгo para usar este comando!");
if(EmTrabalho[playerid] == 0)
return SendClientMessage(playerid, COR_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(playerid, COR_ERRO, "ERRO: Este jogador nгo estб conectado.");
if (ProxDetectorS(5.0, playerid, id))
{
if(Player[playerid][pCORE] >= 5) TotalMaconhaApreendida[1] += Player[id][pMaconha];
else if(Player[playerid][pEXC] >= 5) TotalMaconhaApreendida[2] += Player[id][pMaconha];
else if(Player[playerid][pBOPE] >= 5) TotalMaconhaApreendida[3] += Player[id][pMaconha];
else if(Player[playerid][pPMRJ] >= 5) TotalMaconhaApreendida[4] += Player[id][pMaconha];
else if(Player[playerid][pFEDERAL] >= 5) TotalMaconhaApreendida[4] += Player[id][pMaconha];
if(Player[playerid][pCORE] >= 5) TotalCocainaApreendida[1] += Player[id][pCocaina];
else if(Player[playerid][pEXC] >= 5) TotalCocainaApreendida[2] += Player[id][pCocaina];
else if(Player[playerid][pBOPE] >= 5) TotalCocainaApreendida[3] += Player[id][pCocaina];
else if(Player[playerid][pPMRJ] >= 5) TotalCocainaApreendida[4] += Player[id][pCocaina];
else if(Player[playerid][pFEDERAL] >= 5) TotalCocainaApreendida[4] += Player[id][pCocaina];
if(Player[playerid][pCORE] >= 5) TotalLancaApreendida[1] += Player[id][pLanca];
else if(Player[playerid][pEXC] >= 5) TotalLancaApreendida[2] += Player[id][pCocaina];
else if(Player[playerid][pBOPE] >= 5) TotalLancaApreendida[3] += Player[id][pLanca];
else if(Player[playerid][pPMRJ] >= 5) TotalLancaApreendida[4] += Player[id][pLanca];
else if(Player[playerid][pFEDERAL] >= 5) TotalLancaApreendida[4] += Player[id][pLanca];
Player[id][pMaconha] = 0;
Player[id][pCocaina] = 0;
Player[id][pLanca] = 0;
SendFormattedMessage(id, COR_INFO, "{535353}INFO: O polнcial %s retirou suas drogas.", getPName(playerid) );
SendFormattedMessage(playerid, COR_INFO, "{535353}INFO: Vocк retirou as drogas de %s.", getPName(id) );
SalvarDadosOrgsCops();
}
return 1;
}
I honestly do not know what the problem
Re: Command does not recognize ID and only returns pre-defined error messages (sscanf) -
yvoms - 25.11.2015
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;
}