SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/10/2018, 01:41 PM   #1
sonn51280
Big Clucker
 
sonn51280's Avatar
 
Join Date: Jun 2017
Location: Vietnamese
Posts: 54
Reputation: 0
Default sscanf warning: No default value found. ?

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

sorry i bad english
https://uphinhnhanh.com/image/8vSHL0
__________________
Mr Sơn
sonn51280 is offline   Reply With Quote
Old 10/10/2018, 01:56 PM   #2
UFF
Huge Clucker
 
UFF's Avatar
 
Join Date: Feb 2018
Location: Funky World
Posts: 304
Reputation: 27
Default Re: sscanf warning: No default value found. ?

Provide the code of the command!
__________________
(¯`ˇ._.ˇUltimate Funky Freeroam._.ˇ´¯)



UFF is offline   Reply With Quote
Old 10/10/2018, 02:10 PM   #3
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,104
Reputation: 3166
Default Re: sscanf warning: No default value found. ?

You did something like `sscanf(input, "I", val)` instead of `sscanf(input, "i", val)` or `sscanf(input, "I(21)", val)`.
Y_Less is offline   Reply With Quote
Old 11/10/2018, 12:11 PM   #4
sonn51280
Big Clucker
 
sonn51280's Avatar
 
Join Date: Jun 2017
Location: Vietnamese
Posts: 54
Reputation: 0
Default Re: sscanf warning: No default value found. ?

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;
}
__________________
Mr Sơn
sonn51280 is offline   Reply With Quote
Old 11/10/2018, 12:14 PM   #5
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,584
Reputation: 466
Default Re: sscanf warning: No default value found. ?

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

Code:
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".
NaS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sscanf warning: No default value found. RedGun2015 Scripting Help 5 26/09/2017 03:05 PM
sscanf warning: No default value found. Pokemon64 Scripting Help 5 12/12/2016 03:54 PM
sscanf warning: No default value found. wordflexx Server Support 0 02/03/2016 07:57 AM
[Help] +1 rep sscanf warning: No default value found Dister_Robi Scripting Help 2 21/07/2013 12:08 PM
Is it bad to have sscanf warning: No default value found? Nostrum Scripting Help 2 10/05/2013 03:07 PM


All times are GMT. The time now is 03:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.