Help with dcmd and sscanf
#1

Since i've been having CPU usage problems with my gamemode. I'm re-writing a lot of it. i've removed lots of useless pieces of code, i probably wrote without even thinking.

Anyway im trying to re-write the commands using dcmd and sscanf.

This is an example command i've done, but its sending the message to ID 0 and not the intended id.

pawn Код:
dcmd_caps(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1 && !PlayerTempMod[playerid] && !PlayerTempAdmin[playerid] && !IsPlayerAdmin(playerid)) return DenyMessage(playerid, 1);

    new giveplayerid;
    if(sscanf(params, "u", giveplayerid)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /caps [playerid]");
  else if(giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "Invalid Player ID.");
  else
  {
    SendClientMessage(giveplayerid, COLOR_YELLOW, "Please DO NOT use CAPs on this server...Thank You!");
        PlayerPlaySound(giveplayerid, 1147, 0,0,0);
        SendClientMessage(playerid, COLOR_PINK, "Message Sent!");
    }
  return 1;
}
Reply


Messages In This Thread
Help with dcmd and sscanf - by Outbreak - 13.08.2009, 10:01
Re: Help with dcmd and sscanf - by ruarai - 13.08.2009, 10:05
Re: Help with dcmd and sscanf - by Andom - 13.08.2009, 10:54
Re: Help with dcmd and sscanf - by Outbreak - 13.08.2009, 11:51

Forum Jump:


Users browsing this thread: 1 Guest(s)