Quote:
Originally Posted by _Zeus
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?
|
Through pawno.exe
This is the codes that seems like using sscanf when I search up sscanf.
pawn Код:
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;
}
pawn Код:
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;
}
And yes after I use /kick I get the warning (got the warning with z before, but after I changed it to s it got fixed. But still the other warning)
pawn Код:
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;
}
pawn Код:
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;
}
pawn Код:
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;
}
pawn Код:
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;
}
pawn Код:
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;
}