16.12.2014, 18:01
Код:
CMD:storegun(playerid, params[]) { if(AdminDuty[playerid] == 1) { SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin."); return 1; } if(GetPVarInt(playerid, "PBM") > 0) { SendClientMessage(playerid, COLOR_WHITE, "You're not able to do this while in a paintball game."); return 1; } if(GetPVarInt(playerid, "EventToken") != 0) { SendClientMessage(playerid, COLOR_GREY, "You can't use this while you're in an event."); return 1; } new string[128], weaponchoice[32], slot; if(sscanf(params, "s[32]d", weaponchoice, slot)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /storegun [weapon] [slot]"); if(GetPlayerVirtualWorld(playerid) == PlayerInfo[playerid][pHouse]+6000) { if(PlayerInfo[playerid][pHouse] != INVALID_HOUSE_ID) { if(GetPVarInt(playerid, "GiveWeaponTimer") > 0) { format(string, sizeof(string), " You must wait %d seconds before depositing another weapon.", GetPVarInt(playerid, "GiveWeaponTimer")); SendClientMessage(playerid,COLOR_GREY,string); return 1; } new maxslots = HouseInfo[PlayerInfo[playerid][pHouse]][hGLUpgrade]; if(slot > maxslots) { SendClientMessage(playerid, COLOR_GREY, "Invalid slot."); return 1; } if(HouseInfo[PlayerInfo[playerid][pHouse]][hWeapons][slot-1] != 0) { SendClientMessage(playerid, COLOR_GREY, "You have a weapon stored in that slot already."); return 1; } new weapon; if(strcmp(weaponchoice, "sdpistol", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][2] == 23 && PlayerInfo[playerid][pAGuns][2] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a silenced pistol into your gun locker."); weapon = PlayerInfo[playerid][pGuns][2]; format(string,sizeof(string), "* %s deposited their silenced pistol in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "deagle", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][2] == 24 && PlayerInfo[playerid][pAGuns][2] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a Desert Eagle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][2]; format(string,sizeof(string), "* %s deposited their Desert Eagle in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "shotgun", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][3] == 25 && PlayerInfo[playerid][pAGuns][3] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a shotgun in your gun locker."); weapon = PlayerInfo[playerid][pGuns][3]; format(string,sizeof(string), "* %s deposited their Shotgun in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "spas12", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][3] == 27 && PlayerInfo[playerid][pAGuns][3] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a combat shotgun in your gun locker."); weapon = PlayerInfo[playerid][pGuns][3]; format(string,sizeof(string), "* %s deposited their Combat Shotgun in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "mp5", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 29 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an MP5 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their MP5 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "ak47", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][5] == 30 && PlayerInfo[playerid][pAGuns][5] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an AK-47 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][5]; format(string,sizeof(string), "* %s deposited their AK-47 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "m4", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][5] == 31 && PlayerInfo[playerid][pAGuns][5] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an M4 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][5]; format(string,sizeof(string), "* %s deposited their M4 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "rifle", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][6] == 33 && PlayerInfo[playerid][pAGuns][6] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a rifle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][6]; format(string,sizeof(string), "* %s deposited their riflein their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "sniper", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][6] == 34 && PlayerInfo[playerid][pAGuns][6] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a sniper rifle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][6]; format(string,sizeof(string), "* %s deposited their sniper rifle in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "uzi", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 28 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an uzi in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their uzi in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "tec9", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 32 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a tec9 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their tec9 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } if(weapon == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have that weapon."); if(HouseInfo[PlayerInfo[playerid][pHouse]][hWeapons][slot-1] == 0) { HouseInfo[PlayerInfo[playerid][pHouse]][hWeapons][slot-1] = weapon; RemovePlayerWeapon(playerid, weapon); SaveHouses(); PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid); PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid); GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32); GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]); GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessage(playerid,COLOR_GREY," Invalid weapon name!"); return 1; } } } else if(GetPlayerVirtualWorld(playerid) == PlayerInfo[playerid][pHouse2]+6000) { if(PlayerInfo[playerid][pHouse2] != INVALID_HOUSE_ID) { if(GetPVarInt(playerid, "GiveWeaponTimer") > 0) { format(string, sizeof(string), " You must wait %d seconds before depositing another weapon.", GetPVarInt(playerid, "GiveWeaponTimer")); SendClientMessage(playerid,COLOR_GREY,string); return 1; } new maxslots = HouseInfo[PlayerInfo[playerid][pHouse2]][hGLUpgrade]; if(slot > maxslots) { SendClientMessage(playerid, COLOR_GREY, "Invalid slot."); return 1; } if(HouseInfo[PlayerInfo[playerid][pHouse2]][hWeapons][slot-1] != 0) { SendClientMessage(playerid, COLOR_GREY, "You have a weapon stored in that slot already."); return 1; } new weapon; if(strcmp(weaponchoice, "sdpistol", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][2] == 23 && PlayerInfo[playerid][pAGuns][2] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a silenced pistol into your gun locker."); weapon = PlayerInfo[playerid][pGuns][2]; format(string,sizeof(string), "* %s deposited their silenced pistol in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "deagle", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][2] == 24 && PlayerInfo[playerid][pAGuns][2] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a Desert Eagle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][2]; format(string,sizeof(string), "* %s deposited their Desert Eagle in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "shotgun", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][3] == 25 && PlayerInfo[playerid][pAGuns][3] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a shotgun in your gun locker."); weapon = PlayerInfo[playerid][pGuns][3]; format(string,sizeof(string), "* %s deposited their Shotgun in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "spas12", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][3] == 27 && PlayerInfo[playerid][pAGuns][3] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a combat shotgun in your gun locker."); weapon = PlayerInfo[playerid][pGuns][3]; format(string,sizeof(string), "* %s deposited their Combat Shotgun in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "mp5", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 29 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an MP5 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their MP5 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "ak47", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][5] == 30 && PlayerInfo[playerid][pAGuns][5] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an AK-47 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][5]; format(string,sizeof(string), "* %s deposited their AK-47 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "m4", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][5] == 31 && PlayerInfo[playerid][pAGuns][5] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an M4 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][5]; format(string,sizeof(string), "* %s deposited their M4 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "rifle", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][6] == 33 && PlayerInfo[playerid][pAGuns][6] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a rifle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][6]; format(string,sizeof(string), "* %s deposited their riflein their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "sniper", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][6] == 34 && PlayerInfo[playerid][pAGuns][6] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a sniper rifle in your gun locker."); weapon = PlayerInfo[playerid][pGuns][6]; format(string,sizeof(string), "* %s deposited their sniper rifle in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "uzi", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 28 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited an uzi in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their uzi in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } else if(strcmp(weaponchoice, "tec9", true, strlen(weaponchoice)) == 0) { if(PlayerInfo[playerid][pGuns][4] == 29 && PlayerInfo[playerid][pAGuns][4] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have deposited a tec9 in your gun locker."); weapon = PlayerInfo[playerid][pGuns][4]; format(string,sizeof(string), "* %s deposited their tec9 in their house safe.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER); } } if(weapon == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't have that weapon."); if(HouseInfo[PlayerInfo[playerid][pHouse2]][hWeapons][slot-1] == 0) { HouseInfo[PlayerInfo[playerid][pHouse2]][hWeapons][slot-1] = weapon; RemovePlayerWeapon(playerid, weapon); SaveHouses(); PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid); PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid); GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32); GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]); GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]); OnPlayerStatsUpdate(playerid); return 1; } else { SendClientMessage(playerid,COLOR_GREY," Invalid weapon name!"); return 1; } } } else { SendClientMessage(playerid, COLOR_WHITE, "You're not in any house"); } return 1; }