19.03.2015, 08:27
Код:
CMD:trunktake(playerid, params[]) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while you're inside a vehicle."); } else if(GetPVarInt(playerid, "IsInArena") >= 0) { return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!"); } else if(GetPVarInt( playerid, "EventToken") != 0) { return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event."); } //else if(PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pWRestricted] > 0) { //return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are limited from using weapons for your first 2 hours of gameplay."); //} else if(GetPVarInt(playerid, "GiveWeaponTimer") >= 1) { new szMessage[59]; format(szMessage, sizeof(szMessage), " You must wait %d seconds before getting another weapon.", GetPVarInt(playerid, "GiveWeaponTimer")); return SendClientMessageEx(playerid, COLOR_GREY, szMessage); } new Float: fVehPos[3], iWeaponSlot = strval(params); for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++) { if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) { GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], fVehPos[0], fVehPos[1], fVehPos[2]); if(IsPlayerInRangeOfPoint(playerid, 4.0, fVehPos[0], fVehPos[1], fVehPos[2])) { if(isnull(params)) { new szMessage[64]; format(szMessage, sizeof(szMessage), "*** %s's %s Safe ***", GetPlayerNameEx(playerid), GetVehicleName(PlayerVehicleInfo[playerid][d][pvId])); SendClientMessageEx(playerid, COLOR_WHITE, szMessage); for(new s = 0; s < 3; s++) if(PlayerVehicleInfo[playerid][d][pvWeapons][s] != 0) { new szWeapon[16]; GetWeaponName(PlayerVehicleInfo[playerid][d][pvWeapons][s], szWeapon, sizeof(szWeapon)); format(szMessage, sizeof(szMessage), "Slot %d: %s, Ammo: %d", s+1, szWeapon, PlayerVehicleInfo[playerid][d][pvWepAmmo][s]); SendClientMessageEx(playerid, COLOR_WHITE, szMessage); } return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /trunktake [slot]"); } else if(GetVehicleModel(PlayerVehicleInfo[playerid][d][pvId]) == 481 || GetVehicleModel(PlayerVehicleInfo[playerid][d][pvId]) == 509) { return SendClientMessageEx(playerid,COLOR_GREY,"That vehicle doesn't have a trunk."); } new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(PlayerVehicleInfo[playerid][d][pvId], engine, lights, alarm, doors, bonnet, boot, objective); if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) { return SendClientMessageEx(playerid, COLOR_GRAD3, "You can't take weapons from the trunk if it's closed! /car trunk to open it."); } else if(iWeaponSlot > PlayerVehicleInfo[playerid][d][pvWepUpgrade] + 1) { return SendClientMessageEx(playerid, COLOR_GREY, "Invalid slot specified."); } else if(PlayerVehicleInfo[playerid][d][pvWeapons][iWeaponSlot - 1] != 0) { new szWeapon[16], szMessage[128]; GetWeaponName(PlayerVehicleInfo[playerid][d][pvWeapons][iWeaponSlot - 1], szWeapon, sizeof(szWeapon)); GivePlayerValidWeapon(playerid, PlayerVehicleInfo[playerid][d][pvWeapons][iWeaponSlot - 1], PlayerVehicleInfo[playerid][d][pvWepAmmo][iWeaponSlot - 1]); PlayerVehicleInfo[playerid][d][pvWeapons][iWeaponSlot - 1] = 0; PlayerVehicleInfo[playerid][d][pvWepAmmo][iWeaponSlot - 1] = 0; format(szMessage, sizeof(szMessage), "You have withdrawn a %s from your car gun locker.", szWeapon); SendClientMessageEx(playerid, COLOR_WHITE, szMessage); format(szMessage, sizeof(szMessage), "* %s has withdrawn a %s from their car safe.", GetPlayerNameEx(playerid), szWeapon); return ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have a weapon stored in that slot."); } } } return SendClientMessageEx(playerid,COLOR_GREY,"You are not near any vehicle that you own."); }