CMD:adjust(playerid, params[]) { if(PlayerInfo[playerid][pFMember] == INVALID_FAMILY_ID) { SendClientMessageEx(playerid, COLOR_GREY, "You aren't in a family."); return 1; } new family = PlayerInfo[playerid][pFMember]; new string[128], file[32], month, day, year; getdate(year,month,day); if(PlayerInfo[playerid][pRank] >= 5) { new choice[32], opstring[100]; if(sscanf(params, "s[32]S[100]", choice, opstring)) { SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /adjust [name]"); SendClientMessageEx(playerid, COLOR_WHITE, "Available Names: Name, Safe"); return 1; } if(strcmp(choice,"name",true) == 0) { if(PlayerInfo[playerid][pRank] == 6) { if(!opstring[0]) { SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /adjust name [family name]"); return 1; } if(strfind(opstring, "|", true) != -1) { SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use '|' in a family name."); return 1; } if(strlen(opstring) >= 40 ) { SendClientMessageEx( playerid, COLOR_GRAD1, "That family name is too long, please refrain from using more than 40 characters." ); return 1; } strmid(FamilyInfo[family][FamilyName], opstring, 0, strlen(opstring), 100); SaveFamilies(); SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted your family's name."); format(string, sizeof(string), "%s adjusted %s's name to %s", GetPlayerNameEx(playerid), FamilyInfo[family][FamilyName], opstring); format(file, sizeof(file), "family_logs/%d/%d-%02d-%02d.log", family, year, month, day); Log(file, string); } } else if(strcmp(choice,"safe",true) == 0) { if(PlayerInfo[playerid][pRank] == 6) { SendClientMessageEx(playerid, COLOR_GRAD1, "Adjusting your Family Safe will reset all your safe stats."); SendClientMessageEx(playerid, COLOR_GRAD1, "If you want to adjust your safe, type /adjust confirm."); SendClientMessageEx(playerid, COLOR_GRAD1, "Upgrading your family safe will cost $50,000."); return 1; } } else if(strcmp(choice,"confirm",true) == 0) { if(PlayerInfo[playerid][pRank] == 6) { if(GetPlayerCash(playerid) < 50000) { SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have $50,000 to upgrade your family safe."); return 1; } GivePlayerCash(playerid, -50000); GetPlayerPos(playerid, FamilyInfo[family][FamilySafe][0], FamilyInfo[family][FamilySafe][1], FamilyInfo[family][FamilySafe][2]); FamilyInfo[family][FamilySafeVW] = GetPlayerVirtualWorld(playerid); FamilyInfo[family][FamilySafeInt] = GetPlayerInterior(playerid); FamilyInfo[family][FamilyCash] = 0; FamilyInfo[family][FamilyMats] = 0; FamilyInfo[family][FamilyPot] = 0; FamilyInfo[family][FamilyCrack] = 0; if(FamilyInfo[family][FamilyUSafe]) DestroyDynamicPickup(FamilyInfo[family][FamilyPickup]); FamilyInfo[family][FamilyUSafe] = 1; FamilyInfo[family][FamilyPickup] = CreateDynamicPickup(1239, 23, FamilyInfo[family][FamilySafe][0], FamilyInfo[family][FamilySafe][1], FamilyInfo[family][FamilySafe][2], .worldid = FamilyInfo[family][FamilySafeVW], .interiorid = FamilyInfo[family][FamilySafeInt]); SaveFamilies(); SendClientMessageEx(playerid, COLOR_WHITE, "You've adjusted your family's Safe."); format(string, sizeof(string), "%s adjusted %s's safe", GetPlayerNameEx(playerid), FamilyInfo[family][FamilyName]); format(file, sizeof(file), "family_logs/%d/%d-%02d-%02d.log", family, year, month, day); Log(file, string); } } } else { SendClientMessageEx(playerid, COLOR_GREY, " You do not have a high enough rank to use this command!"); return 1; } return 1;
sscanf warning: No default value found. sscanf warning: Unknown format specifier '[', skipping. sscanf warning: Unknown format specifier '1', skipping. sscanf warning: Unknown format specifier '0', skipping. sscanf warning: Unknown format specifier '0', skipping. sscanf warning: Unknown format specifier ']', skipping. sscanf warning: Format specifier does not match parameter count.
S[100]
S(string)[length] Optional string
Your first parameter.
Код:
S[100] Код:
S(string)[length] Optional string Change S[100] to S()[100] and see if the results are different. |
CMD:editglocker(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pGangModerator] >= 1) { new string[128], choice[32], id, amount; if(sscanf(params, "s[32]dD", choice, id, amount))
if(sscanf(params, "s[32]dD(-1)", choice, id, amount))
small letter for non optional parameter, capital letter for optional parameter which need to specif a default value for it too.
so if you wanna use S you gotta assign default value and a size. default value inside () size inside [] so now we get that, your D needs a default value. -> PHP код:
|