[Ajuda] Comando - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Comando (
/showthread.php?tid=364028)
Comando -
The_G0dFather - 29.07.2012
Bom й o seguinte o comando й para apreender o veiculo...
Sу que o membro do DETRAN pode usar isso em qualquer lugar mesmo a 100kilometros de distвncia do carro. Eu queria que sу pudesse usar quando estiver perto do carro.
Ahh e outra coisa, queria um comando /veiculosapreendidos que mostrasse uma lista com todos veiculos apreendidos.
/prendercarro
pawn Код:
if(strcmp(cmd, "/prendercarro", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USO: /prendercarro [carid]");
return 1;
}
if(PlayerInfo[playerid][pMembro] != 36 && PlayerInfo[playerid][pLider] != 36)
{
SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк nгo estб autorizado a usar este comando.");
return 1;
}
else
{
new carid = strval(tmp);
VehicleInfo[carid][vPRFLock] = 1;
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetVehicleParamsForPlayer(carid, i, 0, 1);
}
SendClientMessage(playerid, COLOR_WHITE, "[Info] Veнculo apreendido.");
}
}
return 1;
}
/liberarcarro
pawn Код:
if(strcmp(cmd, "/liberarcarro", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /liberarcarro [carid]");
return 1;
}
if(PlayerInfo[playerid][pMembro] != 36 && PlayerInfo[playerid][pLider] != 36)
{
SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк nгo estб autorizado a usar este comando.");
return 1;
}
else
{
new carid = strval(tmp);
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetVehicleParamsForPlayer(carid, i, 0, 0);
}
VehicleInfo[carid][vPRFLock] = 0;
SendClientMessage(playerid, COLOR_WHITE, "[Info] Veнculo liberado.");
}
}
return 1;
}
Att. The_GodFather
Re: [Ajuda] Comando -
The_G0dFather - 29.07.2012
Testando!
Att. The_GodFather
Re: [Ajuda] Comando - rjjj - 29.07.2012
Isto deve resolver o seu problema

.
Adicione ao topo do GM:
pawn Код:
new bool:VeiculosApreendidos[MAX_VEHICLES];
Depois troque seus comandos por estes

:
pawn Код:
if(strcmp(cmd, "/prendercarro", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USO: /prendercarro [carid]");
if(PlayerInfo[playerid][pMembro] != 36 && PlayerInfo[playerid][pLider] != 36) return SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк nгo estб autorizado a usar este comando.");
new Veiculo = strval(tmp);
new Float:Coord[3];
GetVehiclePos(Veiculo, Coord[0], Coord[1], Coord[2]);
if(!IsPlayerInRangeOfPoint(playerid, 10.0, Coord[0], Coord[1], Coord[2])) return SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк estб muito distante do veнculo.");
VehicleInfo[Veiculo][vPRFLock] = 1;
for(new x = 0, y = GetMaxPlayers(); x != y; x++)
{
SetVehicleParamsForPlayer(Veiculo, x, 0, 1);
}
VeiculosApreendidos[Veiculo - 1] = true;
SendClientMessage(playerid, COLOR_WHITE, "[Info] Veнculo apreendido.");
return 1;
}
if(strcmp(cmd, "/liberarcarro", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USO: /liberarcarro [carid]");
if(PlayerInfo[playerid][pMembro] != 36 && PlayerInfo[playerid][pLider] != 36) return SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк nгo estб autorizado a usar este comando.");
new Veiculo = strval(tmp);
for(new x = 0, y = GetMaxPlayers(); x != y; x++)
{
SetVehicleParamsForPlayer(Veiculo, x, 0, 0);
}
VehicleInfo[Veiculo][vPRFLock] = 0;
VeiculosApreendidos[Veiculo - 1] = false;
SendClientMessage(playerid, COLOR_WHITE, "[Info] Veнculo liberado.");
return 1;
}
E por fim, coloque junto deles:
pawn Код:
if(strcmp(cmdtext, "/veiculosapreendidos", true) == 0)
{
if(PlayerInfo[playerid][pMembro] != 36 && PlayerInfo[playerid][pLider] != 36) return SendClientMessage(playerid, COLOR_RED, "[Erro] Vocк nгo estб autorizado a usar este comando.");
SendClientMessage(playerid, 0xFFFF00FF, "[ -- Veнculos apreendidos -- ]");
for(new x = 0; x != MAX_VEHICLES; x++)
{
if(!VeiculosApreendidos[x]) continue;
new STR[30];
format(STR, 30, "Veнculo de ID %d", x + 1);
SendClientMessage(playerid, 0xFFFFFFAA, STR);
}
return 1;
}
Espero ter ajudado

.
Re: [Ajuda] Comando -
The_G0dFather - 29.07.2012
Vlwwwww... funcionou.... perfeitamente +rep e rjjj me ajuda com outro comando ?! *_* o /agendar (server para agendar a cadeia do player)
pawn Код:
if(strcmp(cmd, "/agendar",true) == 0)
{
if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1341) return SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/jogar)");
new jogador[128], tempo[128], str[50];
jogador = strtok(cmdtext, idx);
tempo = strtok(cmdtext, idx);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; }
new offset = idx; new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
result[idx - offset] = EOS;
if(!strlen(jogador) || !strlen(tempo) || !strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "USE: /agendar [Nome] [Tempo] [Motivo]");
for(new x = 0, y = GetMaxPlayers(); x != y; x++)
{
if(IsPlayerConnected(x))
{
new nome[24];
GetPlayerName(x, nome, MAX_PLAYER_NAME);
if(!strcmp(nome, jogador)) return SendClientMessage(playerid, COLOR_GREY, " O jogador estб online... Use o comando comum para prendelo. !");
}
}
format(str,sizeof(str), "Contas/%s.ini", jogador);
if(!dini_Exists(str)) return SendClientMessage(playerid, COLOR_GREY, " Nome Invalido! !");
format(string, sizeof(string), "O admin %s agendou %s, %d minutos, Motivo: %s",PlayerName(playerid), jogador, strval(tempo), result);
SendClientMessageToAll(COLOR_LIGHTRED, string);
dini_IntSet(str, "pJailed", 6);
dini_IntSet(str, "pJailTime", strval(tempo) * 60);
return 1;
}
Tipo funciona normalmente mais quando o player a ser preso entra ele continua normalmente como se nada tivesse acontecido.
Att. The_GodFather