new idvariable, something[60]; // Defines new idvariable for the id and something for the string (text) and something's size is 60.
if(sscanf(params, "us[60]", idvariable, something)) // This checks if the player didn't type the command fully, like the player typed /command 0 it will show him this cause he didn't type the text after 0 (id).
if(!IsPlayerConnected(idvariable)) return SendClientMessage(playerid, -1, "Invalid Player ID"); // If the id is not connected it will return him a message in the chat with the white color (-1) Invalid Player ID.
if(sscanf(params, "ds[60]", idvariable, something))
CMD:setstream(playerid, params[])
{
if(!IsPlayerAdmin( playerid ) ) return SendClientMessage(playerid, -1,"You must be a higher level admin to use this command");
new level, aname[MAX_PLAYER_NAME];
new targetid;
if(sscanf(params, "ri", targetid, level)) return SendClientMessage(playerid, -1,"ERROR: /setstream <playerid> <1> allow stream <0> disallow");
if (level > 1 || level < 0) return SendClientMessage(playerid, -1,"ERROR: invalid stream lol");
if(!IsPlayerConnected( targetid )) return SendClientMessage(playerid, -1,"ERROR: player isn't connected");
new string1[130], tname[MAX_PLAYER_NAME], string2[130];
new INI:File = INI_Open(UserPath(targetid ));
INI_SetTag(File,"data");
INI_WriteInt(File,"Stream", pStream);
INI_Close(File);
PlayerInfo[targetid][pStream] = level;
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(targetid, tname, sizeof(tname));
new string3[130],string4[130];
if(level == 0)
{
format(string1, sizeof(string1),"Administrator %s Has Demote You From Deejay STAFF",aname,level);
SendClientMessage(playerid,0xFF9900AA,string1);
format(string3, sizeof(string3),"You was disallow %s to be a deejay",tname,level);
SendClientMessage(targetid,0xFF9900AA,string3);
return 1;
}
if(level == 1)
{
format(string2, sizeof(string2),"Administrator %s Has Set You Stream Level To STAFF, Enjoy",aname,level);
format(string4, sizeof(string4),"You was allowed %s to be a deejay",tname,level);
SendClientMessage(playerid,0xFF9900AA,string4);
SendClientMessage(targetid,0xFF9900AA,string2);
return 1;
}
return 1;
}
That's NOT how you fix the problem "d" is "integer", "u" is "user id or name". You are "fixing" the problem by destroying sscanf functionality (and by extension functionality of your own mode).
for one thing, always make sure you're using the latest version of sscanf. Then don't use "IsPlayerConnected(pid)" but "pid == INVALID_PLAYER_ID". |