Stupid question
#1

Well this is a pretty easy question say you wanna do

Something like this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[30];
  new idx;
  cmd = strtok(cmdtext, idx);
 
  if(strcmp(cmd, "/sayhello", true) == 0)
  {
    new tmp[30];
    // assign the id (written by the user) to tmp
    tmp = strtok(cmdtext, idx);
 
    // convert the id to an integer using strval (this is essential)
    // and assign to otherplayer
    new otherplayer = strval(tmp);
 
    if(IsPlayerConnected(otherplayer))
    {
      SendClientMessage(otherplayer, 0xFFFF00AA, "Hi, hello!");
    }
    return 1;
  }
  return 0;
}
But if you wanted to do ban

It would be like this if I am correct, (leeway, im a new)
Actually, Haha I dont understand really how to attack this, because I dont know what idx is hmm someone could explain or tutor me, that would be good, I understand concepts of C++, and read the tutorial of this but this seem confusing maby because there is stuff I never used before

Reply
#2

directly from the sa-mp wiki

Код:
dcmd_ban(playerid, params[])
{
	new
		id,
		reason[64];
	if (sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <playerid/partname> <reason (optional)>\"");
	else if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
  	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: You are not a high enough admin.");
	else
	{
	 
		BanEx(id, reason);
		format(reason, sizeof (reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
		SendClientMessage(id, 0xFF0000AA, reason);
		SendClientMessage(playerid, 0x00FF00AA, "Player banned");
	}
	return 1;
}
Reply
#3

Can you like post that again with proper identation kind of hard to read corectly...
And also did you make your own custom function their, would you call the command by /dcmd_ban playerid reason or what

Whats this line do

if (sscanf(params, "uz", id, reason)

What is the "uz" and what is sscanf is thast iofile reae?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)