[Ajuda] Comando /su -
adminlucas - 17.09.2011
Olб Galerinha (af)
Bom Pessoal, gostaria de humildemente pedir-lhes um grande favor...
Sou novatгo em SAMP, to estudando umas coisas de Pawn etc...
mas estou tendo um pouco de dor de cabeзa no seguinte comando...
PHP код:
if(strcmp(cmd, "/suspeito", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pMember] == 21 && PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 2)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб indentificado, pegue seu crachб na Delegacia de Policia");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pLeader] == 21 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 21 || PlayerInfo[playerid][pMember] == 17|| PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pMember] == 14)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (gTeam[giveplayerid] != 2 || PlayerInfo[giveplayerid][pMember] != 7 || PlayerInfo[giveplayerid][pLeader] != 7 || PlayerInfo[giveplayerid][pLeader] != 21 || PlayerInfo[giveplayerid][pMember] != 21)
{
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, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode se dar su!"); return 1; }
if(strcmp(result,"DOP",true) == 0) { result = "Desobediкncia a ordem policial"; }
if(strcmp(result,"TH",true) == 0) { result = "Tentativa de homicнdio"; }
if(strcmp(result,"AP",true) == 0) { result = "Ajuste de pena"; }
if(strcmp(result,"CA",true) == 0) { result = "Contrabando de armas"; }
if(strcmp(result,"CD",true) == 0) { result = "Contrabando de drogas"; }
if(strcmp(result,"RV",true) == 0) { result = "Roubo de Veнculo"; }
if(strcmp(result,"ACP",true) == 0) { result = "Atentado contra Prefeitura"; }
if(strcmp(result,"RM",true) == 0) { result = "Rejeiзгo de multa"; }
if(strcmp(result,"RP",true) == 0) { result = "Resistencia a prisгo"; }
if(strcmp(result,"ILR",true) == 0) { result = "Invasгo a Local Restrito"; }
if(strcmp(result,"RMD",true) == 0) { result = "Rejeiзгo a Mostrar Documentos"; }
if(strcmp(result,"DA",true) == 0) { result = "Desacato б Autoridade"; }
if(strcmp(result,"PIA",true) == 0) { result = "Porte Ilegal de Armas"; }
if(strcmp(result,"CF",true) == 0) { result = "Cumplice de Fugas"; }
if(strcmp(result,"AS",true) == 0) { result = "Ameaзa a Sociedade"; }
if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] += 1; }
else{WantedPoints[giveplayerid]+= 1;}
SetPlayerCriminal(giveplayerid,playerid, result);
WantedPoints[giveplayerid] += 1;
TextDrawHideForPlayer(giveplayerid,tGP2[giveplayerid]);
TextDrawShowForPlayer(giveplayerid,tGP3[giveplayerid]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo pode suspeitar de oficial !");
}
}
}
else
{
format(string, sizeof(string), " %d nгo esta online.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo й PM / PF / FA !");
}
}
return 1;
}
Gostaria de restringir este comando somente para as opзхes TH, AS, Etc..
e quando alguem digitar por exemplo, /su [ID] NaoSei
Ele aparecer, SU Invбlido...
Se alguem poder me ajudar, agradeзo...
Sem mais, Lucas
Re: [Ajuda] Comando /su -
[O.z]Caroline - 17.09.2011
tenta:
pawn Код:
if(strcmp(cmd, "/suspeito", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pMember] == 21 && PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 2)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб indentificado, pegue seu crachб na Delegacia de Policia");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pLeader] == 21 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 21 || PlayerInfo[playerid][pMember] == 17|| PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pMember] == 14)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (gTeam[giveplayerid] != 2 || PlayerInfo[giveplayerid][pMember] != 7 || PlayerInfo[giveplayerid][pLeader] != 7 || PlayerInfo[giveplayerid][pLeader] != 21 || PlayerInfo[giveplayerid][pMember] != 21)
{
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, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode se dar su!"); return 1; }
new strlo[100], valid = 0;
if(strcmp(result,"DOP",true) == 0) { result = "Desobediкncia a ordem policial"; valid++; }
if(strcmp(result,"TH",true) == 0) { result = "Tentativa de homicнdio"; valid++; }
if(strcmp(result,"AP",true) == 0) { result = "Ajuste de pena"; valid++;}
if(strcmp(result,"CA",true) == 0) { result = "Contrabando de armas"; valid++; }
if(strcmp(result,"CD",true) == 0) { result = "Contrabando de drogas"; valid++; }
if(strcmp(result,"RV",true) == 0) { result = "Roubo de Veнculo"; valid++; }
if(strcmp(result,"ACP",true) == 0) { result = "Atentado contra Prefeitura"; valid++; }
if(strcmp(result,"RM",true) == 0) { result = "Rejeiзгo de multa";valid++; }
if(strcmp(result,"RP",true) == 0) { result = "Resistencia a prisгo"; valid++; }
if(strcmp(result,"ILR",true) == 0) { result = "Invasгo a Local Restrito"; valid++; }
if(strcmp(result,"RMD",true) == 0) { result = "Rejeiзгo a Mostrar Documentos"; valid++; }
if(strcmp(result,"DA",true) == 0) { result = "Desacato б Autoridade"; valid++; }
if(strcmp(result,"PIA",true) == 0) { result = "Porte Ilegal de Armas"; valid++; }
if(strcmp(result,"CF",true) == 0) { result = "Cumplice de Fugas"; valid++; }
if(strcmp(result,"AS",true) == 0) { result = "Ameaзa a Sociedade"; valid++; }
if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] += 1; valid++; }
if(valid == 0)
return SendClientMessage(Playerid, -1,"Su INvбlido");
else{WantedPoints[giveplayerid]+= 1;}
SetPlayerCriminal(giveplayerid,playerid, result);
WantedPoints[giveplayerid] += 1;
TextDrawHideForPlayer(giveplayerid,tGP2[giveplayerid]);
TextDrawShowForPlayer(giveplayerid,tGP3[giveplayerid]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo pode suspeitar de oficial !");
}
}
}
else
{
format(string, sizeof(string), " %d nгo esta online.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
return 1;
}
#Edit
editei melhor, agora funciona:
pawn Код:
if(strcmp(cmd, "/suspeito", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pMember] == 21 && PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 2)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб indentificado, pegue seu crachб na Delegacia de Policia");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pLeader] == 21 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 21 || PlayerInfo[playerid][pMember] == 17|| PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pMember] == 14)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (gTeam[giveplayerid] != 2 || PlayerInfo[giveplayerid][pMember] != 7 || PlayerInfo[giveplayerid][pLeader] != 7 || PlayerInfo[giveplayerid][pLeader] != 21 || PlayerInfo[giveplayerid][pMember] != 21)
{
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, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode se dar su!"); return 1; }
new strlo[100], valid = 0;
if(strfind(result,"DOP",true) != -1) { strlo = "Desobediкncia a ordem policial"; valid++; }
if(strfind(result,"TH",true) != -1) { strlo = "Tentativa de homicнdio"; valid++; }
if(strfind(result,"AP",true) != -1) { strlo = "Ajuste de pena"; valid++;}
if(strfind(result,"CA",true) != -1) { strlo = "Contrabando de armas"; valid++; }
if(strfind(result,"CD",true) != -1) { strlo = "Contrabando de drogas"; valid++; }
if(strfind(result,"RV",true) != -1) { strlo = "Roubo de Veнculo"; valid++; }
if(strfind(result,"ACP",true) != -1) { strlo = "Atentado contra Prefeitura"; valid++; }
if(strfind(result,"RM",true) != -1) { strlo = "Rejeiзгo de multa";valid++; }
if(strfind(result,"RP",true) != -1) { strlo = "Resistencia a prisгo"; valid++; }
if(strfind(result,"ILR",true) != -1) { strlo = "Invasгo a Local Restrito"; valid++; }
if(strfind(result,"RMD",true) != -1) { strlo = "Rejeiзгo a Mostrar Documentos"; valid++; }
if(strfind(result,"DA",true) != -1) { strlo = "Desacato б Autoridade"; valid++; }
if(strfind(result,"PIA",true) != -1) { strlo = "Porte Ilegal de Armas"; valid++; }
if(strfind(result,"CF",true) != -1) { strlo = "Cumplice de Fugas"; valid++; }
if(strfind(result,"AS",true) != -1) { strlo = "Ameaзa a Sociedade"; valid++; }
if(WantedPoints[giveplayerid] != -1) { WantedPoints[giveplayerid] += 1; valid++; }
if(valid == 0)
return SendClientMessage(Playerid, -1,"Su INvбlido");
else{WantedPoints[giveplayerid]+= 1;}
SetPlayerCriminal(giveplayerid,playerid, strlo);
WantedPoints[giveplayerid] += 1;
TextDrawHideForPlayer(giveplayerid,tGP2[giveplayerid]);
TextDrawShowForPlayer(giveplayerid,tGP3[giveplayerid]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo pode suspeitar de oficial !");
}
}
}
else
{
format(string, sizeof(string), " %d nгo esta online.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
return 1;
}
Re: [Ajuda] Comando /su -
lukas_loky - 17.09.2011
pawn Код:
if(strcmp(cmd, "/suspeito", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pMember] == 21 && PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pMember] == 2)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб indentificado, pegue seu crachб no LSPD HQ.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pLeader] == 7 || PlayerInfo[playerid][pLeader] == 21 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pMember] == 21 || PlayerInfo[playerid][pMember] == 17|| PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pMember] == 14)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (gTeam[giveplayerid] != 2 || PlayerInfo[giveplayerid][pMember] != 7 || PlayerInfo[giveplayerid][pLeader] != 7 || PlayerInfo[giveplayerid][pLeader] != 21 || PlayerInfo[giveplayerid][pMember] != 21)
{
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, "USO: (/su)speito [playerid/Parte-do-Nick] [descriзгo crime]");
return 1;
}
new deucerto[MAX_PLAYERS];
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode se dar su!"); return 1; }
if(strcmp(result,"DOP",true) == 0) { result = "Desobediкncia a ordem policial"; deucerto[playerid]=1; }
if(strcmp(result,"TH",true) == 0) { result = "Tentativa de homicнdio"; deucerto[playerid]=1; }
if(strcmp(result,"AP",true) == 0) { result = "Ajuste de pena"; deucerto[playerid]=1; }
if(strcmp(result,"CA",true) == 0) { result = "Contrabando de armas"; deucerto[playerid]=1; }
if(strcmp(result,"CD",true) == 0) { result = "Contrabando de drogas"; deucerto[playerid]=1; }
if(strcmp(result,"RV",true) == 0) { result = "Roubo de Veнculo"; deucerto[playerid]=1; }
if(strcmp(result,"ACP",true) == 0) { result = "Atentado contra Prefeitura"; deucerto[playerid]=1; }
if(strcmp(result,"RM",true) == 0) { result = "Rejeiзгo de multa"; deucerto[playerid]=1; }
if(strcmp(result,"RP",true) == 0) { result = "Resistencia a prisгo"; deucerto[playerid]=1; }
if(strcmp(result,"ILR",true) == 0) { result = "Invasгo a Local Restrito"; deucerto[playerid]=1; }
if(strcmp(result,"RMD",true) == 0) { result = "Rejeiзгo a Mostrar Documentos"; deucerto[playerid]=1; }
if(strcmp(result,"DA",true) == 0) { result = "Desacato б Autoridade"; deucerto[playerid]=1; }
if(strcmp(result,"PIA",true) == 0) { result = "Porte Ilegal de Armas"; deucerto[playerid]=1; }
if(strcmp(result,"CF",true) == 0) { result = "Cumplice de Fugas"; deucerto[playerid]=1; }
if(deucerto[playerid] == 1)
{
if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] += 1; }
else{WantedPoints[giveplayerid]+= 1;}
SetPlayerCriminal(giveplayerid,playerid, result);
WantedPoints[giveplayerid] += 1;
TextDrawHideForPlayer(giveplayerid,tGP2[giveplayerid]);
TextDrawShowForPlayer(giveplayerid,tGP3[giveplayerid]);
deucerto[playerid]=0;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "Esse SU nao existe, aqui estгo os tipos de SU:");
SendClientMessage(playerid, COLOR_GRAD2, "DOP ------------------------ Desobediкncia a ordem policial");
SendClientMessage(playerid, COLOR_GRAD2, "TH ------------------------- Tentativa de homicнdio");
SendClientMessage(playerid, COLOR_GRAD2, "AP ------------------------- Ajuste de Pena");
SendClientMessage(playerid, COLOR_GRAD2, "CA ------------------------- Contrabando de Armas");
SendClientMessage(playerid, COLOR_GRAD2, "CD ------------------------- Contrabando de Drogas");
SendClientMessage(playerid, COLOR_GRAD2, "RV ------------------------- Roubo de Veнculo");
SendClientMessage(playerid, COLOR_GRAD2, "ACP ------------------------ Atentado contra prefeitura");
SendClientMessage(playerid, COLOR_GRAD2, "RM ------------------------- Reijeiзao de multa");
SendClientMessage(playerid, COLOR_GRAD2, "RP ------------------------- Resistencia a prisгo");
SendClientMessage(playerid, COLOR_GRAD2, "ILR ------------------------ Invasгo a local restrito");
SendClientMessage(playerid, COLOR_GRAD2, "RMD ------------------------ Rejeiзao a mostrar Documentos");
SendClientMessage(playerid, COLOR_GRAD2, "DA ------------------------- Desacato a Autoridade");
SendClientMessage(playerid, COLOR_GRAD2, "PIA ------------------------ Porte Ilegal de armas");
SendClientMessage(playerid, COLOR_GRAD2, "CF ------------------------- Cumplice de Fugas");
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo pode suspeitar de oficial !");
}
}
}
else
{
format(string, sizeof(string), " %d nгo й um player ativo.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo й PM / PF / FA !");
}
}
return 1;
}
Re: [Ajuda] Comando /su -
adminlucas - 17.09.2011
Resolvido, Obrigado,
Nгo acredito que era sу isso ¬¬
desculpem minha tolice.