pawn Код:
CMD:detener(playerid, params[])
{
if(IsACop(playerid))
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes hacer esto en un vehiculo.");
new string[128], giveplayerid, seat;
if(sscanf(params, "dd", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_WHITE, "USA: /detener [playerid] [Asiento 1-3]");
if(IsPlayerConnectedEx(giveplayerid))
{
if(seat < 1 || seat > 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "Asientos: 1 al 3.");
if(IsACop(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes detener a esta persona (LSPD/FBI/SAEM).");
if(IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Esa persona estб en un vehiculo.");
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "No puedes hacer esto contigo mismo!"); return 1; }
if(Info[giveplayerid][pEstado] == 2)
{
new carid = gLastCar[playerid];
if(IsSeatAvailable(carid, seat))
{
new Float:pos[6];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
GetVehiclePos( carid, pos[0], pos[1], pos[2]);
if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
format(string, sizeof(string), "* Fuiste detenido por %s .", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_GENERAL, string);
format(string, sizeof(string), "* Detuviste a %s .", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_GENERAL, string);
format(string, sizeof(string), "* %s sube a %s al vehiculo.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Detenido", 2500, 3);
ClearAnimations(giveplayerid);
TogglePlayerControllable(giveplayerid, false);
PutPlayerInVehicle(giveplayerid, carid, seat);
}
else return SendClientMessageEx(playerid, COLOR_GREY, "Ese asiento no estб disponible!");
}
else return SendClientMessageEx(playerid, COLOR_GREY, "Esa persona no estб esposada");
}
else return SendClientMessageEx(playerid, COLOR_GREY, " Usted no estб lo suficientemente cerca del jugador o de su coche!");
}
else return SendClientMessageEx(playerid, COLOR_GREY, "Jugador especificado invбlido.");
}
else SendClientMessageEx(playerid, COLOR_GRAD2, " No eres policнa!");
return 1;
}