17.12.2014, 03:44
try
pawn Код:
CMD:coptrunk(playerid, params[])
{
new string[128], done, idx;
if( IsPlayerLoggedIn(playerid))
{
new Float:vx, Float:vy, Float:vz;
new car = GetClosestVehicle(playerid);
//new car = GetPlayerVehicleID(playerid);
//if(car <= 0 || GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
if(car <= 0 || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT || DistanceBetweenPlayerAndVeh(playerid, car) > 5.0) return
SendClientMessage(playerid, COLOR_LIGHTRED, " You aren't near any vehicle!");
idx = car;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective);
if(!boot)
{
SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective);
format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~g~Trunk Opened", 3500, 3);
topened[playerid] = 1;
}
else
{
SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective);
format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GameTextForPlayer(playerid, "~r~Trunk Closed", 3500, 3);
topened[playerid] = 0;
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
return 1;
}