13.07.2012, 23:42
Alguem tem o comando /procurar em strcmp ?
CMD:procurar(playerid, params[])
{
new id;
if(sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"[ERRO] Um erro ocorreu ao tentar processar o comando.");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"[ERRO] Jogador nгo conectado.");
SetPlayerWantedLevel(id, GetPlayerWantedLevel(id)+1);
SendClientMessage(playerid,-1,"DEBUG: Player procurado.");
return true;
}
if(strcmp(cmd, "/procurar", true) == 0) { { new id; if(sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"[ERRO] Um erro ocorreu ao tentar processar o comando."); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"[ERRO] Jogador nгo conectado."); SetPlayerWantedLevel(id, GetPlayerWantedLevel(id)+1); SendClientMessage(playerid,-1,"DEBUG: Player procurado."); return true; }
if(strcmp(cmd, "/localizar", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, CORRETO, "[USO CORRETO] /localizar [id do player]");
return 1;
}
giveplayerid = strval(tmp);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(logado[playerid] == 1)
{
if(PlayerInfo[playerid][pPM] >= 2 || PlayerInfo[playerid][pBOPE] >= 2 || PlayerInfo[playerid][pGDE] >= 2 || PlayerInfo[playerid][pChoque] >= 2)
{
if(IsPlayerConnected(giveplayerid))
{
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
CP[playerid] = 1;
GameTextForPlayer(playerid, "~r~Siga o ponto vermelho no mapa!", 2500, 3);
new PlayerName[30];
GetPlayerName(playerid, PlayerName, 30);
printf("[Comando] %s usou /localizar em %s.", PlayerName, giveplayer);
}
else
{
format(string, sizeof(string), "[ERRO] %d nгo й um player ativo.", giveplayerid);
SendClientMessage(playerid, ERRO, string);
}
}
else
{
SendClientMessage(playerid, ERRO, "[ERRO] Vocк nгo tem permissгo para usar este comando!");
}
}
else
{
SendClientMessage(playerid, ERRO, "[ERRO] Vocк tem que estar logado para usar este comando!");
}
return 1;
}
if(strcmp(cmd, "/prender", true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), P_CONTAS, aname);
if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Recruta || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Rotam || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "pAdm01") == 1)
{
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Use: /prender [id] [motivo]");
return 1;
}
plid = strval(tmp);
if(GetPlayerWantedLevel(plid) == 0)
{
return SendClientMessage(playerid, -1, "{2F7AFC} Esse jogador nгo estб sendo procurado, portanto nгo poderб ser preso!");
}
if(IsPlayerInAnyVehicle(plid) == 1 || IsPlayerInAnyVehicle(playerid) == 1)
{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O Player estб dentro de um carro e nгo pode ser preso.");
return 1 ;
}
if(plid == playerid)
{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} Vocк nгo pode fazer isto com si mesmo.");
return 1 ;
}
if(!IsPlayerConnected(plid))
{
SendClientMessage(playerid, Vermelho, "{0099FF}[x]{CCCCFF} O jogador nгo estб conectado");
return 1;
}
else
{
if(GetDistanceBetweenPlayers(plid,playerid) < 10)
{
//AQUI VAI LER O MOTIVO
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[100];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
//--------------------------------------------
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), P_CONTAS, pname);
format(string, sizeof(string), "[x] O policial %s te prendeu.", aname);
SendClientMessage(plid, AzuL4, string);
SetPlayerPos(plid, 263.8820,77.4002,1001.0391);
SetPlayerInterior(plid, 6);
SetPlayerHealth(plid, 99999);
ResetPlayerWeapons(plid);
dini_IntSet(file2, "Preso", 1);
SendClientMessage(playerid, COLOR_GREEN, "{0099FF}[x]{CCCCFF} Preso com sucesso.");
SetPlayerWantedLevel(plid, 0);
preso[plid] = 1;
TogglePlayerControllable(plid, 1);
//MENSAGEM PARA TODOS
format(string, sizeof(string), "{2F7AFC} | PRISГO | O policial %s prendeu o procurado %s pelo motivo: %s!", aname, pname, (result));
SendClientMessageToAll(-1 ,string);
if(Procurados[plid] == 1)
{
GivePlayerGrana(playerid,100);
Procurados[plid] = 0;
SendClientMessage(playerid, Verde, "{0099FF}[x]{CCCCFF} Vocк ganhou uns trocados por ter prendido um procurado!");
dini_IntSet(file2, "Procurado", 0);
}
return 1;
}
else
{
SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Chegue mais perto para prender!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,Vermelho,"{0099FF}[x]{CCCCFF} Apenas policiais podem usar este comando!");
return 1;
}
}
if(strcmp(cmd, "/suspeito", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й um policial!");
return 1;
}
if(OnDuty[playerid] != 1)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo Bateu o cartгo!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: (/su)speito [id] [Descriзгo do Crime]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsACop(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo pode dar su em Policiais!");
return 1;
}
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: (/su)speito [id] [Descriзгo do Crime]");
return 1;
}
SetPlayerCriminal(giveplayerid,playerid, result);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Esse jogador nгo estб conectado.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo й um Policial !");
}
}
return 1;
}