Pitbul97 Posted December 29, 2020 Report Share Posted December 29, 2020 (edited) Am o problema cu, comanda asta, cand dai /set din prima seteaza rank la factiune cuiva pe 0 CMD:set(playerid, params[]) { new id, item[25], ammount; if(PlayerInfo[playerid][pAdmin] < 4)return SCM(playerid, -1, AdminOnly); //if(PinLogged[playerid] == 0)return SCM(playerid, COLOR_LIGHTRED, "Trebuie sa introduci pin-ul mai intai.(/pin)");// daca nu folositi gm-ul de la mine este obligatoriu sa schimbati acest rand if(sscanf(params, "us[250]i", id, item, ammount)) { SCM(playerid, COLOR_GREY,"Syntaxl: /set <id> <item> <ammount> "); SCM(playerid, COLOR_GREY, "Avabile Items: Group, Rank, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } if(id == INVALID_PLAYER_ID)return SCM(playerid, COLOR_LIGHTRED, "ID sau nume incorect !"); if(strcmp(item, "Rank", true) == 0) { if(PlayerInfo[id][pMember] != 0) { PlayerInfo[id][pRank] = ammount; new str[256]; mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Rank`='%d' WHERE `name`='%s'",PlayerInfo[id][pRank],PlayerInfo[id][pNormalName]); mysql_tquery(SQL,str,"",""); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s rank-ul in factiune la rank %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "Your rank in this faction has been changed."); } } else if(strcmp(item,"Group",true) == 0) { new name[25], name2[25], string[128], string2[128]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(id, name2, sizeof(name2)); new ftext[50]; if(ammount == 12 || ammount == 7) return SCM(playerid, -1, "Invalid faction ID"); if(ammount == 0)return SCM(playerid, COLOR_GREY, "Foloseste /auninvite"); if(ammount == 1) { ftext = "Los Santos Police Departament"; } //Police Force else if(ammount == 2) { ftext = "Federal Bureau Of Investigation"; } //FBI else if(ammount == 3) { ftext = "National Guard"; } //National Guard else if(ammount == 4) { ftext = "Los Aztecas"; } //Los Aztecas else if(ammount == 5) { ftext = "Grove Street"; } //Grove Street else if(ammount == 6) { ftext = "Los Vagos"; } //Los Vagos else if(ammount == 8) { ftext = "Las Venturas Police Departament"; } //LVPD else if(ammount == 9) { ftext = "News Reporter"; } //News Reporter else if(ammount == 10) { ftext = "Ballas"; } //Ballas else if(ammount == 11) { ftext = "Hitman Agency"; } //The Agency else if(ammount == 13) { ftext = "Taxi Los Santos"; } //Los Santos Taxi else if(ammount == 14) { ftext = "Las Venturas Paramedic Departament"; } //Paramedic else if(ammount == 15) { ftext = "The Rifa"; } //Rifa else if(ammount == 16) { ftext = "The Russian Mafia"; } // The russian else if(ammount == 17) { ftext = "Taxi LV"; } // Taxi LV format(string, sizeof(string),"Administratorul %s te-a adaugat ca membru in factiunea %s",name,ftext); format(string2, sizeof(string2),"AdmWarning: %s l-a adaugat ca membru pe %s in factiunea %s",name, name2, ftext); PlayerInfo[id][pMember] = ammount; new str[356]; format(str, sizeof(str),"UPDATE users SET `Member`='%d' WHERE `name`='%s'",PlayerInfo[id][pMember],PlayerInfo[id][pRank],PlayerInfo[id][pNormalName]); mysql_query(SQL, str); ABroadCast(COLOR_LIGHTRED,string2, 4); SCM(id, COLOR_DBLUE, string); } else if(strcmp(item, "Money", true) == 0) { PlayerInfo[id][pCash] = ammount; GivePlayerCash(id, ammount); Update(id, pCashx); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s bani in mana la suma de %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "You recived some money."); } else if(strcmp(item, "PremiumPoints", true) == 0) { PlayerInfo[id][pPremiumPoints] = ammount; Update(id,pPremiumPointsx); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s punctele premium la %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "Your recived some premium points."); } else if(strcmp(item, "BankMoney", true) == 0) { PlayerInfo[id][pAccount] = ammount; Update(id, pBank); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s bani in banca la suma de %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "Your recived some money in bank."); } else if(strcmp(item, "PlayedHours", true) == 0) { PlayerInfo[id][pConnectTime] = ammount; Update(id,pConnectTimex); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s orele jucate la %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "Your played hours has been changed."); } else if(strcmp(item, "PremiumAccount", true) == 0) { if(ammount < 0 || ammount > 1)SCM(playerid, COLOR_GREY, "1 = Cont premium | 0 = Fara cont premium"); PlayerInfo[id][pPremiumAccount] = ammount; Update(id, pPremiumAccountx); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s rank-ul in factiune la rank %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); if(ammount == 0)return SCM(id, -1, "Your premium account has been removed."); if(ammount == 1)return SCM(id, -1, "You recived a premium account ."); } else if(strcmp(item, "FP", true) == 0) { PlayerInfo[id][pFpunish] = ammount; Update(id,pFpunishx); new IDName[25], AdminName[25]; GetPlayerName(id, IDName, sizeof(IDName)); GetPlayerName(playerid, AdminName, sizeof(AdminName)); new text[128]; format(text, sizeof(text), "AdmWarning: %s i-a setat lui %s Faction Punish-ul la %d.", AdminName, IDName, ammount); ABroadCast(COLOR_ORANGE, text, 4); SCM(id, -1, "Your FP has been changed."); } else { SCM(playerid, COLOR_GREY, "Avabile Items: Group, Rank, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } return 1; Edited December 29, 2020 by Pitbul97 Quote Link to comment Share on other sites More sharing options...
segmentationfault Posted December 29, 2020 Report Share Posted December 29, 2020 optimizarea tine de viteza cu care se executa, nu ca nu-ti merge tie.. am intrat degeaba aici, just a guy who doesn't know what he's doing. Quote Link to comment Share on other sites More sharing options...
Banditul Posted December 29, 2020 Report Share Posted December 29, 2020 Asta nu ar trebui sa se intample pentru ca ai Citat if(id == INVALID_PLAYER_ID)return SCM(playerid, COLOR_LIGHTRED, "ID sau nume incorect !"); Care iti verifica primul parametru si daca e invalid adica nu ai introdus nimic) pur si simplu nu se executa. (asta daca ai un space intre ) si return ) Ti-as recomanda sa folosesti unltima versiunea de sscanf https://github.com/maddinat0r/sscanf/releases/tag/v2.8.3 Descarca versiunea de win32, pune fisierul din folderul pawno>include sscanf2.inc si inlocuieste pe cel existent in folderul cu acelasi nume dingm tau. De asemea poti face cu plugin si sa inlocuiesti cu ce ai tu in folderul din gm Este posibil sa ai o versiune mai veche care are aumite buguri 2 Quote Link to comment Share on other sites More sharing options...
Pitbul97 Posted December 29, 2020 Author Report Share Posted December 29, 2020 (edited) 3 hours ago, George-Valentin Hulpoi said: optimizarea tine de viteza cu care se executa, nu ca nu-ti merge tie.. am intrat degeaba aici, just a guy who doesn't know what he's doing. am explicat prost, defapt eu vroiam sa modific pentru ca aveam probleme atunci cand scrii /set automat iti seteaza rank 0 in factiune. Se poate da am rezolvat T/C Edited December 29, 2020 by Pitbul97 Quote Link to comment Share on other sites More sharing options...
VeLo Posted December 30, 2020 Report Share Posted December 30, 2020 Acum 20 ore, Banditul a spus: Asta nu ar trebui sa se intample pentru ca ai Care iti verifica primul parametru si daca e invalid adica nu ai introdus nimic) pur si simplu nu se executa. (asta daca ai un space intre ) si return ) Ti-as recomanda sa folosesti unltima versiunea de sscanf https://github.com/maddinat0r/sscanf/releases/tag/v2.8.3 Descarca versiunea de win32, pune fisierul din folderul pawno>include sscanf2.inc si inlocuieste pe cel existent in folderul cu acelasi nume dingm tau. De asemea poti face cu plugin si sa inlocuiesti cu ce ai tu in folderul din gm Este posibil sa ai o versiune mai veche care are aumite buguri Ultima versiune oferita de Y_Less, este 2.10.2 Quote Link to comment Share on other sites More sharing options...
Banditul Posted December 30, 2020 Report Share Posted December 30, 2020 Acum 18 minute, VeLo a spus: Ultima versiune oferita de Y_Less, este 2.10.2 Ai si un link? Sunt curios de versiunea asta de sscanf pe care nu vad sa o gasesc desi e a doua oara cand aud de ea Quote Link to comment Share on other sites More sharing options...
VeLo Posted December 31, 2020 Report Share Posted December 31, 2020 https://github.com/Y-Less/sscanf/releases/tag/2.10.2-r2 Quote Link to comment Share on other sites More sharing options...
Hackeru Suprem Posted November 1, 2023 Report Share Posted November 1, 2023 CMD:set(playerid, params[]) { new id, item[25], ammount; if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, -1, "You do not have permission to use this command."); if(sscanf(params, "us[25]i", item, id, ammount)) { SCM(playerid, COLOR_GREY, "Syntax: /set <item> <id> <amount>"); SCM(playerid, COLOR_GREY, "Available Items: Rank, Group, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_LIGHTRED, "Invalid ID or name!"); switch(item) { case "Rank": { if(PlayerInfo[id][pMember] != 0) { PlayerInfo[id][pRank] = ammount; new str[256]; mysql_format(SQL, str, sizeof(str), "UPDATE users SET `Rank`='%d' WHERE `name`='%s'", PlayerInfo[id][pRank], PlayerInfo[id][pNormalName]); mysql_tquery(SQL, str, "", ""); SCM(id, -1, "Your rank in this faction has been changed."); } break; } case "Group": { // Handle changing group based on the amount (ammount) // Replace the logic here according to your requirements break; } case "Money": { PlayerInfo[id][pCash] = ammount; GivePlayerCash(id, ammount); Update(id, pCashx); SCM(id, -1, "You received some money."); break; } case "BankMoney": { PlayerInfo[id][pAccount] = ammount; Update(id, pBank); SCM(id, -1, "You received some money in the bank."); break; } case "PlayedHours": { PlayerInfo[id][pConnectTime] = ammount; Update(id, pConnectTimex); SCM(id, -1, "Your played hours have been changed."); break; } case "PremiumPoints": { PlayerInfo[id][pPremiumPoints] = ammount; Update(id, pPremiumPointsx); SCM(id, -1, "You received some premium points."); break; } case "PremiumAccount": { if(ammount < 0 || ammount > 1) { SCM(playerid, COLOR_GREY, "1 = Premium Account | 0 = No Premium Account"); } PlayerInfo[id][pPremiumAccount] = ammount; Update(id, pPremiumAccountx); if(ammount == 0) SCM(id, -1, "Your premium account has been removed."); if(ammount == 1) SCM(id, -1, "You received a premium account."); break; } case "FP": { PlayerInfo[id][pFpunish] = ammount; Update(id, pFpunishx); SCM(id, -1, "Your Faction Punish has been changed."); break; } default: SCM(playerid, COLOR_GREY, "Available Items: Rank, Group, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } return 1; } Quote Link to comment Share on other sites More sharing options...
Sancky Posted November 1, 2023 Report Share Posted November 1, 2023 3 minutes ago, Hackeru Suprem said: CMD:set(playerid, params[]) { new id, item[25], ammount; if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, -1, "You do not have permission to use this command."); if(sscanf(params, "us[25]i", item, id, ammount)) { SCM(playerid, COLOR_GREY, "Syntax: /set <item> <id> <amount>"); SCM(playerid, COLOR_GREY, "Available Items: Rank, Group, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_LIGHTRED, "Invalid ID or name!"); switch(item) { case "Rank": { if(PlayerInfo[id][pMember] != 0) { PlayerInfo[id][pRank] = ammount; new str[256]; mysql_format(SQL, str, sizeof(str), "UPDATE users SET `Rank`='%d' WHERE `name`='%s'", PlayerInfo[id][pRank], PlayerInfo[id][pNormalName]); mysql_tquery(SQL, str, "", ""); SCM(id, -1, "Your rank in this faction has been changed."); } break; } case "Group": { // Handle changing group based on the amount (ammount) // Replace the logic here according to your requirements break; } case "Money": { PlayerInfo[id][pCash] = ammount; GivePlayerCash(id, ammount); Update(id, pCashx); SCM(id, -1, "You received some money."); break; } case "BankMoney": { PlayerInfo[id][pAccount] = ammount; Update(id, pBank); SCM(id, -1, "You received some money in the bank."); break; } case "PlayedHours": { PlayerInfo[id][pConnectTime] = ammount; Update(id, pConnectTimex); SCM(id, -1, "Your played hours have been changed."); break; } case "PremiumPoints": { PlayerInfo[id][pPremiumPoints] = ammount; Update(id, pPremiumPointsx); SCM(id, -1, "You received some premium points."); break; } case "PremiumAccount": { if(ammount < 0 || ammount > 1) { SCM(playerid, COLOR_GREY, "1 = Premium Account | 0 = No Premium Account"); } PlayerInfo[id][pPremiumAccount] = ammount; Update(id, pPremiumAccountx); if(ammount == 0) SCM(id, -1, "Your premium account has been removed."); if(ammount == 1) SCM(id, -1, "You received a premium account."); break; } case "FP": { PlayerInfo[id][pFpunish] = ammount; Update(id, pFpunishx); SCM(id, -1, "Your Faction Punish has been changed."); break; } default: SCM(playerid, COLOR_GREY, "Available Items: Rank, Group, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } return 1; } vezi ca nu stie pawn de string-uri in switch, mai baga o fisa si nu mai folositi chatgpt pt pawn Quote Link to comment Share on other sites More sharing options...
mrrares19 Posted November 1, 2023 Report Share Posted November 1, 2023 CMD:set(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 4)return SCM(playerid, -1, AdminOnly); extract params -> new player:id, string:item[15], ammount; else { SendClientMessage(playerid, COLOR_GREY,"Syntaxl: /set <id> <item> <ammount> "); return SendClientMessage(playerid, COLOR_GREY, "Avabile Items: Group, Rank, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } switch(YHash(item, false)) { case _I<rank>: { PlayerInfo[id][pRank] = ammount; SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s rank-ul in factiune la rank %d.", 1, GetName(playerid), GetName(id), ammount) SendClientMessage(id, -1, "Your rank in this faction has been changed."); mysql_format(SQL, str, sizeof(str), "UPDATE users SET `Rank`='%d' WHERE `name`='%s'",PlayerInfo[id][pRank],PlayerInfo[id][pNormalName]); mysql_tquery(SQL, str, "", ""); } case _I<group>: { switch(ammount) { case 0: return SendClientMessage(playerid, COLOR_GREY, "Foloseste /auninvite"); case 1: ftext = "Los Santos Police Departament"; case 2: ftext = "Federal Bureau Of Investigation"; case 3: ftext = "National Guard"; case 4: ftext = "Los Aztecas"; case 5: ftext = "Grove Street"; case 6: ftext = "Los Vagos"; case 7: return SendClientMessage(playerid, -1, "Invalid faction ID"); case 8: ftext = "Las Venturas Police Departament"; case 9: ftext = "News Reporter"; case 10: ftext = "Ballas"; case 11: ftext = "Hitman Agency"; case 12: return SendClientMessage(playerid, -1, "Invalid faction ID"); case 13: ftext = "Taxi Los Santos"; case 14: ftext = "Las Venturas Paramedic Departament"; case 15: ftext = "The Rifa"; case 16: ftext = "The Russian Mafia"; case 17: ftext = "Taxi LV"; } PlayerInfo[id][pMember] = ammount; va_SendClientMessage(id, COLOR_DBLUE, "Administratorul %s te-a adaugat ca membru in factiunea %s",name,ftext); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s l-a adaugat ca membru pe %s in factiunea %s", 1, name, name2, ftext); mysql_format(gQuery, sizeof(gQuery),"UPDATE users SET `Member`='%d' WHERE `name`='%s'",PlayerInfo[id][pMember],PlayerInfo[id][pRank],PlayerInfo[id][pNormalName]); mysql_tquery(SQL, gQuery, "", ""); } case _I<money>: { PlayerInfo[id][pCash] = ammount; GivePlayerCash(id, ammount); Update(id, pCashx); SendClientMessage(id, -1, "You recived some money."); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s bani in mana la suma de %d.", 1, AdminName, IDName, ammount); } case _I<premiumpoints>: { PlayerInfo[id][pPremiumPoints] = ammount; Update(id,pPremiumPointsx); SendClientMessage(id, -1, "Your recived some premium points."); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s punctele premium la %d.", 1, AdminName, IDName, ammount); } case _I<bankmoney>: { PlayerInfo[id][pAccount] = ammount; Update(id, pBank); SendClientMessage(id, -1, "Your recived some money in bank."); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s bani in banca la suma de %d.", 1, AdminName, IDName, ammount); } case _I<playedhours>: { PlayerInfo[id][pConnectTime] = ammount; Update(id,pConnectTimex); SendClientMessage(id, -1, "Your played hours has been changed."); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s orele jucate la %d.", 1, AdminName, IDName, ammount); } case _I<premiumaccount>: { if(!(0 <= ammount <= 1)) return SendClientMessage(playerid, COLOR_GREY, "1 = Cont premium | 0 = Fara cont premium"); if(ammount == 0) return SendClientMessage(id, -1, "Your premium account has been removed."); if(ammount == 1) return SendClientMessage(id, -1, "You recived a premium account ."); PlayerInfo[id][pPremiumAccount] = ammount; Update(id, pPremiumAccountx); } case _I<factionpunish>: { PlayerInfo[id][pFpunish] = ammount; Update(id,pFpunishx); SendClientMessage(id, -1, "Your FP has been changed."); SendAdminMessage(COLOR_LIGHTRED, "AdmWarning: %s i-a setat lui %s Faction Punish-ul la %d.", 1, AdminName, IDName, ammount); } default: return SendClientMessage(playerid, COLOR_GREY, "Avabile Items: Group, Rank, Money, BankMoney, PlayedHours, PremiumPoints, PremiumAccount, FP"); } return true; } cv facut rapid, n am stat sa rezolv erorile de la Mesaje faceti voi ca sunteti developeri Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.