05.05.2013, 05:18
Not tested...
pawn Код:
CMD:trunk(playerid, params[])
{
new string[128], done, idx;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pVeh] || PlayerInfo[playerid][pVVeh])
{
SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [open/close]");
SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [balance/upgrade]");
SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /trunk [deposit/withdraw] [type] [amount]");
SendClientMessage(playerid, COLOR_GREY, "** Upgrading a trunk costs $25,000 each new level.");
return 1;
}
if(!strcmp(params, "open", true))
{
new Float:vx, Float:vy, Float:vz;
GetVehiclePos(PlayerInfo[playerid][pVeh], vx, vy, vz);
if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
{
idx = PlayerInfo[playerid][pVeh];
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;
}
done = 1;
return 1;
}
GetVehiclePos(PlayerInfo[playerid][pVVeh], vx, vy, vz);
if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz))
{
idx = PlayerInfo[playerid][pVVeh];
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 if(!strcmp(params, "close", true))
{
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;
}
return 1;
}