05.05.2013, 01:13
So I have a /trunk command but it only opens/close the trunk... But I want it so It would be /trunk open/close
code as of now...
how i want it...
code as of now...
Код:
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]) { 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 { 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; } if(!done) SendClientMessage(playerid, COLOR_GREY, "You are not near a vehicle you own."); } else { SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicle."); return 1; } return 1; }
Код:
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)) { } else if(!strcmp(params, "close", true)) { } return 1; }