CMD:hood(playerid, params[]) { for (new i = 1; i != MAX_VEHICLES; i ++) if (IsValidVehicle(i) && IsPlayerNearHood(playerid, i)) { if (!IsDoorVehicle(i)) return SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}This Vehicle Doesn't Have Hood."); if (!GetHoodStatus(i)) { SetHoodStatus(i, true); SendClientMessage(playerid, -1, "You Have {00FF40}Opened{FFFFFF} The Hood"); } else { SetHoodStatus(i, false); SendClientMessage(playerid, -1, "You Have {FF0000}Closed {FFFFFF}The Hood"); } return 1; } SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle"); return 1; }
CMD:hood(playerid, params[])
{
for (new i = 1; i != MAX_VEHICLES; i ++) if (IsValidVehicle(i) && IsPlayerNearHood(playerid, i))
{
if (!IsDoorVehicle(i))
return SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}This Vehicle Doesn't Have Hood.");
if (!GetHoodStatus(i))
{
SetHoodStatus(i, true);
SendClientMessage(playerid, -1, "You Have {00FF40}Opened{FFFFFF} The Hood");
}
else
{
SetHoodStatus(i, false);
SendClientMessage(playerid, -1, "You Have {FF0000}Closed {FFFFFF}The Hood");
}
}
else SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
return 1;
}
No, m pretty sure this wont work. the loop isnt ending it will spam the message.
wait, let me test. Yes, spammed my chat. |
SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle");
Код:
SendClientMessage(playerid, -1, "{FF0000}Error:{FFFFFF}You Are Not In Range Of Any Vehicle"); for example, my max vehicle is 20, so this message comes 20 times. (it came 305 times now though) |
stock IsPlayerNearHood(playerid, vehicleid) { static Float:fX, Float:fY, Float:fZ; GetVehicleHood(vehicleid, fX, fY, fZ); return (GetPlayerVirtualWorld(playerid) == GetVehicleVirtualWorld(vehicleid)) && IsPlayerInRangeOfPoint(playerid, 6.0, fX, fY, fZ); }
This forum requires that you wait 120 seconds between posts. Please try again in 50 seconds. |