PM HELP
#10

You have to add
pawn Код:
new id = strval(tmp);
underneath
pawn Код:
tmp = strtok(cmdtext,idx);
so you should get this

pawn Код:
if(strcmp("/pm", cmd, true) == 0)
{
  tmp = strtok(cmdtext,idx);
  new id=strval(tmp);
  if(!strlen(tmp) || strlen(tmp) > 5) {
    SendClientMessage(playerid,COLOR_GREEN,"Usage: /pm [id] (Message)");
    return 1;
  }


[Off-Topic]
DCMD is just the strcmp method but slightly different.
ZCMD truly is a completely different method (doesn't even use strcmp) so it only needs to be called once per OnPlayerCommandText, where as DCMD is checked and called for each command (until found that is)

Although I must say that ZCMD could easily be made to go faster

ZCMD -> http://zeex.pastebin.ca/1650602 (119 lines)

My version (11 lines)
pawn Код:
#define Command(%1) forward CMD_%1(playerid,params[]);\
public CMD_%1(playerid,params[])
public OnPlayerCommandText(playerid,cmdtext[])
{
  new tmp[128];
  new space = strfind(cmdtext," ");
  new cell;
  format(tmp,space-1,cmdtext[1]);
  while(tmp[cell])tmp[cell]=tolower(tmp[cell]),cell++;
  format(tmp,128,"CMD_%s",tmp);
  return CallLocalFunction(tmp,"is",playerid,cmdtext[space+1]);
}
example command
pawn Код:
Command(test) //playerid and params[] are assumed
{
    SendClientMessage(playerid,0xFFFFFFFF,"This is a test.");
    return 1;
}
Reply


Messages In This Thread
PM HELP - by RoneyRemington - 24.02.2010, 15:48
Re: PM HELP - by RoneyRemington - 24.02.2010, 15:51
Re: PM HELP - by [cA]Unforseen - 24.02.2010, 15:52
Re: PM HELP - by RoneyRemington - 24.02.2010, 15:54
Re: PM HELP - by VonLeeuwen - 24.02.2010, 15:55
Re: PM HELP - by GaGlets(R) - 24.02.2010, 16:40
Re: PM HELP - by gotenks918 - 24.02.2010, 16:41
Re: PM HELP - by GaGlets(R) - 24.02.2010, 16:43
Re: PM HELP - by Doppeyy - 24.02.2010, 16:44
Re: PM HELP - by Joe Staff - 24.02.2010, 17:00

Forum Jump:


Users browsing this thread: 2 Guest(s)