19.11.2011, 00:27
Hi guys,
i just want to use this command only on Police Cars. Just polices can use this command and only with '' IsACopCar(carid) ''
Because im using another car system so LSPD members need to put their weapons in trunk.
If anyone can do this for me i will be very very happy..
(Also you can delete 'FRISK' section..) Thanks, thanks, thanks..
i just want to use this command only on Police Cars. Just polices can use this command and only with '' IsACopCar(carid) ''
Because im using another car system so LSPD members need to put their weapons in trunk.
If anyone can do this for me i will be very very happy..
(Also you can delete 'FRISK' section..) Thanks, thanks, thanks..
Код:
if(strcmp(cmd, "/trunk", true) == 0) // { if(IsPlayerConnected(playerid)) { new x_nr[64]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_WHITE, "HINT: /trunk [name]"); SendClientMessage(playerid, COLOR_WHITE, "Available names: info, putgun, takegun, putarmour, takearmour"); if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2) { SendClientMessage(playerid, COLOR_WHITE, "You can /trunk frisk as a cop"); } return 1; } if(strcmp(x_nr,"info",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else if(PlayerInfo[playerid][pPcarkey3] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s Opens the car trunk and checks whats inside", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SendClientMessage(playerid, COLOR_LIGHT_BLUE, "|_______ Vehicle Trunk _______|"); for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++) { new gunname[100]; if(vehTrunk[result][slot] != 0) { GetWeaponName(vehTrunk[result][slot], gunname, sizeof(gunname)); format(string, sizeof(string), "| Slot %i: %s (Ammo: %i)", slot, gunname, vehTrunkAmmo[result][slot]); SendClientMessage(playerid, COLOR_WHITE, string); } else { format(string, sizeof(string), "| Slot %i: Empty (Ammo: N/A)", slot); SendClientMessage(playerid, COLOR_WHITE, string); } } format(string, sizeof(string), "| Body armour: %f%", vehTrunkArmour[result]); SendClientMessage(playerid, COLOR_WHITE, string); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s opens the trunk and checks what is inside.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"putgun",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(vehTrunkCounter[result] != (MAX_TRUNK_SLOTS-1)) { if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else if(PlayerInfo[playerid][pPcarkey3] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(ReduceTime[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " You need to wait 3 seconds before using this command !"); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHspdCar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83|| GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } new buffer[512]; new gunname[100]; new gunID = GetPlayerWeapon(playerid); new gunAmmo = GetPlayerAmmo(playerid); if(gunID != 0 && gunAmmo != 0) { ReduceTime[playerid] = 1; SetTimerEx("ReduceTimer", 3000, false, "i", playerid); GetWeaponName(gunID, gunname, sizeof(gunname)); vehTrunkCounter[result]++; vehTrunk[result][vehTrunkCounter[result]] = gunID; vehTrunkAmmo[result][vehTrunkCounter[result]] = gunAmmo; format(buffer, sizeof(buffer), "You have put your %s (Ammo: %i) in the car's trunk.", gunname, gunAmmo); SendClientMessage(playerid, COLOR_WHITE, buffer); RemovePlayerWeapon(playerid, gunID); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s opens car's trunk and puts a weapon there.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SaveTrunk(); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " Car's trunk is full"); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"takegun",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(ReduceTime[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " You need to wait 3 seconds before using this command !"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else if(PlayerInfo[playerid][pPcarkey3] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHspdCar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } if(vehTrunkCounter[result] != 0) { ReduceTime[playerid] = 1; SetTimerEx("ReduceTimer", 3000, false, "i", playerid); new buffer[512]; new gunName[100]; SafeGivePlayerWeapon(playerid, vehTrunk[result][vehTrunkCounter[result]], vehTrunkAmmo[result][vehTrunkCounter[result]]); GetWeaponName(vehTrunk[result][vehTrunkCounter[result]], gunName, sizeof(gunName)); format(buffer, sizeof(buffer), "You've taken a %s (Ammo: %i) from the vehicle.", gunName, vehTrunkAmmo[result][vehTrunkCounter[result]]); SendClientMessage(playerid, COLOR_WHITE, buffer); vehTrunk[result][vehTrunkCounter[result]] = '\0'; vehTrunkAmmo[result][vehTrunkCounter[result]] = '\0'; vehTrunkCounter[result]--; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s opens car's trunk and takes a weapon.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is empty ! "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"putarmour",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else if(PlayerInfo[playerid][pPcarkey3] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHspdCar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } new Float:plyArmour; GetPlayerArmour(playerid, plyArmour); if(plyArmour != 0) { SetPlayerArmour(playerid, 0); vehTrunkArmour[result] = plyArmour; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s takes off his/her body armour and puts it into car trunk.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " You haven't got any armour "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"takearmour",true) == 0) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); return 1; } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAnOwnableCar(result)) { if(PlayerInfo[playerid][pPcarkey] == result) { } else if(PlayerInfo[playerid][pPcarkey2] == result) { } else if(PlayerInfo[playerid][pPcarkey3] == result) { } else { SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !"); return 1; } } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHspdCar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } if(vehTrunkArmour[result] != 0) { SetPlayerArmour(playerid, vehTrunkArmour[result]); vehTrunkArmour[result] = 0; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s takes out the body armour from the trunk and puts it on.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SaveTrunk(); return 1; } else { SendClientMessage(playerid, COLOR_GREY, " There are no body armour in the trunk ! "); return 1; } } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } return 1; } else if(strcmp(x_nr,"frisk",true) == 0) { if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) { new counter = 0; new result; new plyName[MAX_PLAYER_NAME]; GetPlayerName(playerid, plyName, MAX_PLAYER_NAME); for(new i; i != MAX_VEHICLES; i++) { new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i); if(dist) { result = i; counter++; } } switch(counter) { case 0: { SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you"); } case 1: { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, " You can't open the trunk while you're in the car"); return 1; } if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHspdCar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83 || GetVehicleModel(GetPlayerVehicleID(result)) == 523) { SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !"); return 1; } SendClientMessage(playerid, COLOR_LIGHT_BLUE, "|_______ Vehicle Trunk _______|"); for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++) { new gunname[100]; if(vehTrunk[result][slot] != 0) { GetWeaponName(vehTrunk[result][slot], gunname, sizeof(gunname)); format(string, sizeof(string), "| Slot %i: %s (Ammo: %i)", slot, gunname, vehTrunkAmmo[result][slot]); SendClientMessage(playerid, COLOR_WHITE, string); } else { format(string, sizeof(string), "| Slot %i: Empty (Ammo: N/A)", slot); SendClientMessage(playerid, COLOR_WHITE, string); } } format(string, sizeof(string), "| Body armour: %f%", vehTrunkArmour[result]); SendClientMessage(playerid, COLOR_WHITE, string); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s opens the trunk and checks what is inside.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } default: { SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range"); return 1; } } } else { SendClientMessage(playerid, COLOR_GREY, " You're not the cop ! "); return 1; } return 1; } else { SendClientMessage(playerid, COLOR_WHITE, "HINT: /trunk [name]"); SendClientMessage(playerid, COLOR_WHITE, "Available names: info, putgun, takegun, putarmour, takearmour"); if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2) { SendClientMessage(playerid, COLOR_WHITE, "You can /trunk frisk as a cop"); } return 1; } } return 1; }