sscanf warning: No default value found. ?
#1

i use /gedit model -> tome -> all for error ?

sorry i bad english
https://uphinhnhanh.com/image/8vSHL0
Reply
#2

Provide the code of the command!
Reply
#3

i open server-samp in website 'LINUX' not error ? : open Windows error ?

https://www.solidfiles.com/v/NjeD3kG53epwp

Quote:

CMD:gedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pShopTech] >= 1)
{
new x_job[128], gateid, Floatfloat, string[128];

if(sscanf(params, "s[128]iF", x_job, gateid, ofloat))
{
SendClientMessageEx(playerid, COLOR_GREY, "SU DUNG: /gedit [name] [gateid] [value]");
SendClientMessageEx(playerid, COLOR_GREY, "Ten co san: HID, Model, VW, Int, Open, Closed, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M), ToMe(M)");
SendClientMessageEx(playerid, COLOR_GREY, "Ten co san: Range, Speed, Allegiance, GroupType, GroupID, FamilyID, Stream, Timer, Auto");
return 1;
}

if(strcmp(x_job, "hid", true) == 0)
{
new value = floatround(ofloat, floatround_round);
if(value > MAX_HOUSES) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid House ID!");
GateInfo[gateid][gHID] = value;
format(string, sizeof(string), "HID %d assigned to Gate %d", GateInfo[gateid][gHID], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's House ID to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "model", true) == 0)
{
new value = floatround(ofloat, floatround_round);

if(value == 0)
{
GateInfo[gateid][gPosX] = 0.0;
GateInfo[gateid][gPosY] = 0.0;
GateInfo[gateid][gPosZ] = 0.0;
GateInfo[gateid][gRotX] = 0.0;
GateInfo[gateid][gRotY] = 0.0;
GateInfo[gateid][gRotZ] = 0.0;
GateInfo[gateid][gPosXM] = 0.0;
GateInfo[gateid][gPosYM] = 0.0;
GateInfo[gateid][gPosZM] = 0.0;
GateInfo[gateid][gRotXM] = 0.0;
GateInfo[gateid][gRotYM] = 0.0;
GateInfo[gateid][gRotZM] = 0.0;
GateInfo[gateid][gVW] = 0;
GateInfo[gateid][gInt] = 0;
GateInfo[gateid][gAllegiance] = 0;
GateInfo[gateid][gGroupType] = 0;
GateInfo[gateid][gGroupID] = -1;
GateInfo[gateid][gFamilyID] = -1;
}

GateInfo[gateid][gModel] = value;
format(string, sizeof(string), "Model %d assigned to Gate %d", GateInfo[gateid][gModel], gateid);
if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
CreateGate(gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Model to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "vw", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gVW] = value;
format(string, sizeof(string), "Virtual World %d assigned to Gate %d", GateInfo[gateid][gVW], gateid);
if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
CreateGate(gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's VW to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "int", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gInt] = value;
format(string, sizeof(string), "Interior %d assigned to Gate %d", GateInfo[gateid][gInt], gateid);
if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
CreateGate(gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's InteriorID to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "open", true) == 0)
{
foreach(new i:Player)
{
if(GetPVarInt(i, "EditingGateID") == gateid && i != playerid)
{
format(string, sizeof(string), "ERROR: %s (ID: %d) is currently editing this gate.", GetPlayerNameEx(i), i);
return SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
SetPVarInt(playerid, "gEdit", 1);
SetPVarInt(playerid, "EditingGateID", gateid);
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX], GateInfo[gateid][gRotY], GateInfo[gateid][gRotZ]);
EditDynamicObject(playerid, GateInfo[gateid][gGATE]);
format(string, sizeof(string), "You are now editing the open position of Gate %d.", gateid);
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, 0xFFFFAAAA, "HINT: Hold {8000FF}~k~~PED_SPRINT~ {FFFFAA}to move your camera, press escape to cancel");
}
else if(strcmp(x_job, "closed", true) == 0)
{
foreach(new i:Player)
{
if(GetPVarInt(i, "EditingGateID") == gateid && i != playerid)
{
format(string, sizeof(string), "ERROR: %s (ID: %d) is currently editing this gate.", GetPlayerNameEx(i), i);
return SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
SetPVarInt(playerid, "gEdit", 2);
SetPVarInt(playerid, "EditingGateID", gateid);
EditDynamicObject(playerid, GateInfo[gateid][gGATE]);
format(string, sizeof(string), "You are now editing the closed position of Gate %d.", gateid);
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, 0xFFFFAAAA, "HINT: Hold {8000FF}~k~~PED_SPRINT~ {FFFFAA}to move your camera, press escape to cancel");
}
else if(strcmp(x_job, "range", true) == 0)
{
GateInfo[gateid][gRange] = ofloat;
format(string, sizeof(string), "Range of %.3f assigned to Gate %d", GateInfo[gateid][gRange], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Range to %.3f.", GetPlayerNameEx(playerid), gateid, ofloat);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "speed", true) == 0)
{
GateInfo[gateid][gSpeed] = ofloat;
format(string, sizeof(string), "Speed of %.3f assigned to Gate %d", GateInfo[gateid][gSpeed], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Speed to %.3f.", GetPlayerNameEx(playerid), gateid, ofloat);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "posx", true) == 0)
{
GateInfo[gateid][gPosX] = ofloat;
format(string, sizeof(string), "PosX %f assigned to Gate %d", GateInfo[gateid][gPosX], gateid);
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "posy", true) == 0)
{
GateInfo[gateid][gPosY] = ofloat;
format(string, sizeof(string), "PosY %f assigned to Gate %d", GateInfo[gateid][gPosY], gateid);
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "posz", true) == 0)
{
GateInfo[gateid][gPosZ] = ofloat;
format(string, sizeof(string), "PosZ %f assigned to Gate %d", GateInfo[gateid][gPosZ], gateid);
SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "posxm", true) == 0)
{
GateInfo[gateid][gPosXM] = ofloat;
format(string, sizeof(string), "PosXM %f assigned to Gate %d", GateInfo[gateid][gPosXM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "posym", true) == 0)
{
GateInfo[gateid][gPosYM] = ofloat;
format(string, sizeof(string), "PosYM %f assigned to Gate %d", GateInfo[gateid][gPosYM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "poszm", true) == 0)
{
GateInfo[gateid][gPosZM] = ofloat;
format(string, sizeof(string), "PosZM %f assigned to Gate %d", GateInfo[gateid][gPosZM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "rotx", true) == 0)
{
GateInfo[gateid][gRotX] = ofloat;
format(string, sizeof(string), "RotX %f assigned to Gate %d", GateInfo[gateid][gRotX], gateid);
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "roty", true) == 0)
{
GateInfo[gateid][gRotY] = ofloat;
format(string, sizeof(string), "RotY %f assigned to Gate %d", GateInfo[gateid][gRotY], gateid);
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "rotz", true) == 0)
{
GateInfo[gateid][gRotZ] = ofloat;
format(string, sizeof(string), "RotZ %f assigned to Gate %d", GateInfo[gateid][gRotZ], gateid);
SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "rotxm", true) == 0)
{
GateInfo[gateid][gRotXM] = ofloat;
format(string, sizeof(string), "RotXM %f assigned to Gate %d", GateInfo[gateid][gRotXM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "rotym", true) == 0)
{
GateInfo[gateid][gRotYM] = ofloat;
format(string, sizeof(string), "RotYM %f assigned to Gate %d", GateInfo[gateid][gRotYM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "rotzm", true) == 0)
{
GateInfo[gateid][gRotZM] = ofloat;
format(string, sizeof(string), "RotZM %f assigned to Gate %d", GateInfo[gateid][gRotZM], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);
}
else if(strcmp(x_job, "tome", true) == 0)
{
GetPlayerPos(playerid,GateInfo[gateid][gPosX],GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
GateInfo[gateid][gVW] = GetPlayerVirtualWorld(playerid);
GateInfo[gateid][gInt] = GetPlayerInterior(playerid);
format(string, sizeof(string), "Gate %d Pos moved to %f %f %f, VW: %d INT: %d", gateid, GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ], GateInfo[gateid][gVW], GateInfo[gateid][gInt]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(GateInfo[gateid][gModel] == 0)
{
GateInfo[gateid][gModel] = 18631;
GateInfo[gateid][gRange] = 10;
GateInfo[gateid][gSpeed] = 5.0;
}
if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
CreateGate(gateid);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Position.", GetPlayerNameEx(playerid), gateid);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "tomem", true) == 0)
{
GetPlayerPos(playerid,GateInfo[gateid][gPosXM],GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
format(string, sizeof(string), "Gate %d PosM moved to %f %f %f", gateid, GateInfo[gateid][gPosXM], GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Moved Position.", GetPlayerNameEx(playerid), gateid);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "allegiance", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gAllegiance] = value;
format(string, sizeof(string), "Allegiance %d assigned to Gate %d", GateInfo[gateid][gAllegiance], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Allegiance to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "grouptype", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gGroupType] = value;
format(string, sizeof(string), "Group Type %d assigned to Gate %d", GateInfo[gateid][gGroupType], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Group Type to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "groupid", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gGroupID] = value;
format(string, sizeof(string), "Group ID %d assigned to Gate %d", GateInfo[gateid][gGroupID], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Group ID to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "familyid", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gFamilyID] = value;
format(string, sizeof(string), "Family ID %d assigned to Gate %d", GateInfo[gateid][gFamilyID], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's Family ID to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "stream", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gRenderHQ] = value;
format(string, sizeof(string), "Stream distance %d assigned to Gate %d", GateInfo[gateid][gRenderHQ], gateid);
if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
CreateGate(gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's stream distance to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "timer", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gTimer] = value;
format(string, sizeof(string), "Timer %d assigned to Gate %d", GateInfo[gateid][gTimer], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's timer to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
else if(strcmp(x_job, "auto", true) == 0)
{
new value = floatround(ofloat, floatround_round);
GateInfo[gateid][gAutomate] = value;
if(GateInfo[gateid][gAutomate] == 1)
{
foreach(new i: Player) SetTimerEx("AutomaticGateTimer", 1000, false, "ii", i, gateid);
}
format(string, sizeof(string), "Automation %d assigned to Gate %d", GateInfo[gateid][gAutomate], gateid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveGate(gateid);

format(string, sizeof(string), "%s has edited GateID %d's automation to %d.", GetPlayerNameEx(playerid), gateid, value);
Log("logs/gedit.log", string);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong duoc phep su dung lenh nay.");
return 1;
}
return 1;
}

Reply
#4

Код:
if(sscanf(params, "s[128]iF", x_job, gateid, ofloat))
should be something like

Код:
if(sscanf(params, "s[128]iF(10.0)", x_job, gateid, ofloat))
where 10.0 would be the default value if that argument isn't passed. If it shouldn't be optional, use "f" instead of "F".
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)