31.07.2016, 21:38
Hello I am using this family safe script, but whenever I try to store or take anything it just returns the same text that shows the syntax. No matter what I do it keeps writing "USAGE: /fsafe get [money|mats|pot|crack|gun] "
Код:
if(strcmp(cmd, "/fsafe", true) == 0) { new fam = PlayerInfo[playerid][pFMember]; if (fam == 255) { SendClientMessage(playerid, COLOR_GREY, " You aren't in a family."); return 1; } if(FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafe] == 0) { SendClientMessage(playerid, COLOR_GRAD2, " Your family does not own a safe !"); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 2, FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafePos][0], FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafePos][1], FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafePos][2])) { SendClientMessage(playerid, COLOR_GRAD2, " You are not at your Family Safe !"); return 1; } new x_nr[32]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe [put|get]"); return 1; } if(strcmp(x_nr,"put",true) == 0) { new subcmd[24]; if (!strlen(subcmd)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe put [mats|pot|crack|gun] [amount|name]"); return 1; } tmp = strtok(cmdtext,idx); if (!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe get [mats|pot|crack|gun] [amount|name]"); return 1; } new amount; amount = strval(tmp); // fput mats if(strcmp(subcmd, "mats", true) == 0) { if(PlayerInfo[playerid][pMats] < amount) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much materials."); return 1; } if(amount < 1 || amount > 50000) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 50000."); return 1; } if(FamilyInfo[fam][FamilyMats] + amount > 200000) { SendClientMessage(playerid,COLOR_GREY," Family safe can't hold more than 200,000 materials."); return 1; } PlayerInfo[playerid][pMats] -= amount; FamilyInfo[fam][FamilyMats] += amount; SaveFamilies(); format(string, sizeof(string), "* %s deposits materials into a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fput pot if(strcmp(subcmd, "pot", true) == 0) { if(PlayerInfo[playerid][pPot] < amount) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much pot."); return 1; } if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 50."); return 1; } if(FamilyInfo[fam][FamilyPot] + amount > 50) { SendClientMessage(playerid,COLOR_GREY," Family safe can't hold more than 50 pot."); return 1; } PlayerInfo[playerid][pPot] -= amount; FamilyInfo[fam][FamilyPot] += amount; SaveFamilies(); format(string, sizeof(string), "* %s deposits some pot into a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fput crack if(strcmp(subcmd, "crack", true)==0) { if(PlayerInfo[playerid][pCrack] < amount) { SendClientMessage(playerid, COLOR_GREY, " You don't have that much crack."); return 1; } if(amount < 1 || amount > 25) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 25."); return 1; } if(FamilyInfo[fam][FamilyCrack] + amount > 25) { SendClientMessage(playerid,COLOR_GREY," Family safe can't hold more than 50 crack."); return 1; } PlayerInfo[playerid][pCrack] -= amount; FamilyInfo[fam][FamilyCrack] += amount; SaveFamilies(); format(string, sizeof(string), "* %s deposits some crack into a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fput gun if(strcmp(subcmd, "gun", true)==0) { new stored = 0; new weapon = GetPlayerWeapon(playerid); if(strcmp(tmp, "colt45", true) == 0) { if(FamilyInfo[fam][Colt45] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family Colt45 locker is full."); return 1; } if(weapon != 22 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a Colt45."); return 1; } FamilyInfo[fam][Colt45]++; TakeWeapon(playerid,22); stored = 1; } if(strcmp(tmp, "shotgun", true) == 0) { if(FamilyInfo[fam][Shotgun] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family Shotgun locker is full."); return 1; } if(weapon != 25 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a Shotgun."); return 1; } FamilyInfo[fam][Shotgun]++; TakeWeapon(playerid,25); stored = 1; } if(strcmp(tmp, "mp5", true) == 0) { if(FamilyInfo[fam][MP5] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family MP5 locker is full."); return 1; } if(weapon != 29 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a MP5."); return 1; } FamilyInfo[fam][MP5]++; TakeWeapon(playerid,29); stored = 1; } if(strcmp(tmp, "ak47", true) == 0) { if(FamilyInfo[fam][AK47] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family AK47 locker is full."); return 1; } if(weapon != 30 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding an AK47."); return 1; } FamilyInfo[fam][AK47]++; TakeWeapon(playerid,30); stored = 1; } if(strcmp(tmp, "m4", true) == 0) { if(FamilyInfo[fam][M4] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family M4 locker is full."); return 1; } if(weapon != 31 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding an M4."); return 1; } FamilyInfo[fam][M4]++; TakeWeapon(playerid,31); stored = 1; } if(strcmp(tmp, "spas12", true) == 0) { if(FamilyInfo[fam][SPAS12] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family SPAS12 locker is full."); return 1; } if(weapon != 27 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a SPAS12."); return 1; } FamilyInfo[fam][SPAS12]++; TakeWeapon(playerid,27); stored = 1; } if(strcmp(tmp, "rifle", true) == 0) { if(FamilyInfo[fam][Rifle] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family Rifle locker is full."); return 1; } if(weapon != 33 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a Rifle."); return 1; } FamilyInfo[fam][Rifle]++; TakeWeapon(playerid,33); stored = 1; } if(strcmp(tmp, "sniper", true) == 0) { if(FamilyInfo[fam][Sniper] >= 10) { SendClientMessage(playerid, COLOR_GREY, " Your family Sniper locker is full."); return 1; } if(weapon != 34 || HaveWeapon(playerid,weapon) != weapon) { SendClientMessage(playerid,COLOR_GREY, " You are not holding a Sniper."); return 1; } FamilyInfo[fam][Sniper]++; TakeWeapon(playerid,34); stored = 1; } if(stored == 1) { format(string, sizeof(string), "* %s places a %s into a safe.", PlayerName(playerid), tmp); ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SaveFamilies(); } return 1; } else SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe put [money|mats|pot|crack|gun] [amount|name]"); } if(strcmp(x_nr,"get",true) == 0) { new subcmd[24]; if (!strlen(subcmd)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe get [mats|pot|crack|gun] [amount|name]"); return 1; } tmp = strtok(cmdtext,idx); if (!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe get [mats|pot|crack|gun] [amount|name]"); return 1; } new amount; amount = strval(tmp); // fget mats if(strcmp(subcmd, "mats", true) == 0) { if(PlayerInfo[playerid][pFRank] < 5) return SendClientMessage(playerid,COLOR_GREY," Only rank 5+ is allowed to take family materials."); if(amount > FamilyInfo[fam][FamilyMats]) { SendClientMessage(playerid, COLOR_GREY, " Family safe doesn't have that much materials."); return 1; } if(amount < 1 || amount > 50000) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 50000."); return 1; } PlayerInfo[playerid][pMats] += amount; FamilyInfo[fam][FamilyMats] -= amount; SaveFamilies(); format(string, sizeof(string), "* %s takes some materials from a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fget pot if(strcmp(subcmd, "pot", true) == 0) { if(PlayerInfo[playerid][pFRank] < 5) return SendClientMessage(playerid,COLOR_GREY," Only rank 5+ is allowed to take family pot."); if(amount > FamilyInfo[fam][FamilyPot]) { SendClientMessage(playerid, COLOR_GREY, " Family safe doesn't have that much pot."); return 1; } if(amount < 1 || amount > 50) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 50."); return 1; } if(amount + PlayerInfo[playerid][pPot] > 50) { SendClientMessage(playerid, COLOR_GREY, " You can only hold a max of 50 pot."); return 1; } PlayerInfo[playerid][pPot] += amount; FamilyInfo[fam][FamilyPot] -= amount; SaveFamilies(); format(string, sizeof(string), "* %s takes some pot from a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fget crack if(strcmp(subcmd, "crack", true)==0) { if(PlayerInfo[playerid][pFRank] < 5) return SendClientMessage(playerid,COLOR_GREY," Only rank 5+ is allowed to take family crack."); if(amount > FamilyInfo[fam][FamilyCrack]) { SendClientMessage(playerid, COLOR_GREY, " Family safe doesn't have that much crack."); return 1; } if(amount < 1 || amount > 25) { SendClientMessage(playerid, COLOR_GREY, " Amount must be between 1 and 25."); return 1; } if(amount + PlayerInfo[playerid][pCrack] > 25) { SendClientMessage(playerid, COLOR_GREY, " You can only hold a max of 25 crack."); return 1; } PlayerInfo[playerid][pCrack] += amount; FamilyInfo[fam][FamilyCrack] -= amount; SaveFamilies(); format(string, sizeof(string), "* %s takes some crack from a safe.", PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); return 1; } // fget gun if(strcmp(subcmd, "gun", true)==0) { if(PlayerInfo[playerid][pFRank] < 2) return SendClientMessage(playerid,COLOR_GREY," Only rank 2+ is allowed to take family guns."); new got = 0; if(strcmp(tmp, "colt45", true) == 0) { if(FamilyInfo[fam][Colt45] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family Colt45 locker is empty."); return 1; } if(HaveWeapon(playerid,22) == 22) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a Colt45."); return 1; } FamilyInfo[fam][Colt45]--; GivePlayerGun(playerid,22); got = 1; } if(strcmp(tmp, "shotgun", true) == 0) { if(FamilyInfo[fam][Shotgun] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family Shotgun locker is empty."); return 1; } if(HaveWeapon(playerid,25) == 25) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a Shotgun."); return 1; } FamilyInfo[fam][Shotgun]--; GivePlayerGun(playerid,25); got = 1; } if(strcmp(tmp, "mp5", true) == 0) { if(FamilyInfo[fam][MP5] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family MP5 locker is empty."); return 1; } if(HaveWeapon(playerid,29) == 29) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a MP5."); return 1; } FamilyInfo[fam][MP5]--; GivePlayerGun(playerid,29); got = 1; } if(strcmp(tmp, "ak47", true) == 0) { if(FamilyInfo[fam][AK47] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family AK47 locker is empty."); return 1; } if(HaveWeapon(playerid,30) == 30) { SendClientMessage(playerid,COLOR_GREY, " You are already holding an AK47."); return 1; } FamilyInfo[fam][AK47]--; GivePlayerGun(playerid,30); got = 1; } if(strcmp(tmp, "m4", true) == 0) { if(FamilyInfo[fam][M4] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family M4 locker is empty."); return 1; } if(HaveWeapon(playerid,31) == 31) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a M4."); return 1; } FamilyInfo[fam][M4]--; GivePlayerGun(playerid,31); got = 1; } if(strcmp(tmp, "spas12", true) == 0) { if(FamilyInfo[fam][SPAS12] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family SPAS12 locker is empty."); return 1; } if(HaveWeapon(playerid,27) == 27) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a SPAS12."); return 1; } FamilyInfo[fam][SPAS12]--; GivePlayerGun(playerid,27); got = 1; } if(strcmp(tmp, "rifle", true) == 0) { if(FamilyInfo[fam][Rifle] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family Rifle locker is empty."); return 1; } if(HaveWeapon(playerid,33) == 33) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a Rifle."); return 1; } FamilyInfo[fam][Rifle]--; GivePlayerGun(playerid,33); got = 1; } if(strcmp(tmp, "sniper", true) == 0) { if(FamilyInfo[fam][Sniper] <= 0) { SendClientMessage(playerid, COLOR_GREY, " Your family Sniper locker is empty."); return 1; } if(HaveWeapon(playerid,34) == 34) { SendClientMessage(playerid,COLOR_GREY, " You are already holding a Sniper."); return 1; } FamilyInfo[fam][Sniper]--; GivePlayerGun(playerid,34); got = 1; } if(got == 1) { format(string, sizeof(string), "* %s takes a %s from a safe.", PlayerName(playerid), tmp); ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SaveFamilies(); } return 1; } else SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe get [money|mats|pot|crack|gun] [amount|name]"); } else SendClientMessage(playerid, COLOR_GREY, "USAGE: /fsafe [put|get]"); return 1; }