[12:29:50] sscanf warning: 'z' is deprecated, consider using 'S' instead. [12:29:50] sscanf warning: No default value found. [12:29:50] sscanf warning: Strings without a length are deprecated, please add a destination size. [12:52:51] sscanf warning: 'z' is deprecated, consider using 'S' instead. [12:52:51] sscanf warning: No default value found. [12:52:51] sscanf warning: Strings without a length are deprecated, please add a destination size. [12:53:45] sscanf warning: 'z' is deprecated, consider using 'S' instead. [12:53:45] sscanf warning: No default value found. [12:53:45] sscanf warning: Strings without a length are deprecated, please add a destination size. |
You have to include to your mode the sscanf2 but the syntax is sscanf. It finds 'z' instead of 'S' so I'm about to ask you. Do you open your file through pawno.exe or by double clicking on the file?
|
CMD:dance(playerid, params[])
{
new animid;
if(sscanf(params, "i", animid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dance [1-4]");
if(animid < 1 || animid > 4) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dance [1-4]");
switch(animid)
{
case 1: SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE1);
case 2: SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE2);
case 3: SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE3);
case 4: SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE4);
}
return 1;
}
CMD:kick(playerid,params[])
{
new id,name1[MAX_PLAYER_NAME], reason[35],name2[MAX_PLAYER_NAME], string[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command.");
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /kick [playerid/partofname] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string),"AdmCmd: %s was kicked by %s, reason: %s",name2,name1,reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
Kick(id);
}
return 1;
}
CMD:goto(playerid, params[])
{
new ID;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command");
else if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [partofname/playerid]");
else if(!IsPlayerConnected(ID)) SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
}
return 1;
}
CMD:gethere(playerid,params[])
{
new targetid, Float:x, Float:y, Float:z;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command");
else if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gethere [playerid/partofname]");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected");
else
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(targetid, x, y+0.5, z+0.5);
}
return 1;
}
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 0 || value > 10) return SendClientMessage(playerid, COLOR_GREY, "Unknown level.");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to admin level %i", tName, value);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "You have been promoted to admin level %i by %s", value, pName);
SendClientMessage(pID, COLOR_LIGHTRED, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}
CMD:mute(playerid,params[])
{
new id,time,name1[MAX_PLAYER_NAME],reason[35],name2[MAX_PLAYER_NAME], string[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command.");
if(sscanf(params,"uis", id, time, reason)) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /mute [playerid/partofname] [minutes] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
PlayerInfo[id][pMuted] = 1;
PlayerInfo[id][pMuteTime] = time*60;
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
format(string, sizeof(string), "AdmCmd: %s was silenced by %s for %d minute(s), reason: %s",name2 ,name1,time,reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
}
return 1;
}
CMD:warn(playerid, params[])
{
new id, sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[35], string[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command.");
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid, COLOR_GREY,"Usage: /warn [playerid/partofname] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player id");
else
{
if(PlayerInfo[id][pWarns] >= 10)
{
format(string, sizeof(string), "AdmCmd: %s was banned by %s (10 warnings) reason %s", name, sendername, reason);
SendClientMessageToAll(COLOR_LIGHTRED, string);
new plrIP[16];
GetPlayerIp(id,plrIP, sizeof(plrIP));
SendClientMessage(id,COLOR_LIGHTBLUE,"|___________[BAN INFO]___________|");
format(string, sizeof(string), "Your name: %s.",name);
SendClientMessage(id, COLOR_WHITE, string);
format(string, sizeof(string), "Your ip is: %s.",plrIP);
SendClientMessage(id, COLOR_WHITE, string);
format(string, sizeof(string), "You were banned by: %s.",sendername);
SendClientMessage(id, COLOR_WHITE, string);
format(string, sizeof(string), "You were banned for: %s.",reason);
SendClientMessage(id, COLOR_WHITE, string);
SendClientMessage(id,COLOR_LIGHTBLUE,"|___________[BAN INFO]___________|");
Ban(id);
}
PlayerInfo[id][pWarns] += 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
GetPlayerName(id, name, sizeof(name));
format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, reason);
SendClientMessage(id, COLOR_LIGHTRED, string);
format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason %s", name, sendername, reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
}
return 1;
}
if(sscanf(params,"us",id,reason))
if(sscanf(params,"us[35]",id,reason))
if(sscanf(params,"us[128]",id,reason))
You need to assign a length to "s", since it is a string.
Код:
if(sscanf(params,"us[128]",id,reason)) |
Oh thank you, but anyways on the lenght on for example kick, what does it do with the command if I for example set the lenght as 1?
|
Why do you want to do that? The reason will store the size you gave and if you exceed that lenght, another warning will come up: sscanf warning: String buffer overflow
|
Oh so I may just write in e.g 128 and if I not sue more than 128 characters, it won't give warning. So it is better using higher lenght instead of short lenght?
And that is just if s is there? or what since I have another one with just "u" shall I add anything to it? Like lenght? |