Pm command
#10

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Well I don't use any of ZCMD, sscanf, MySQL.

Can you add the command without any of those stuff? cos I dont have them
Well, I've already given you one which is done using Strcmp. Here it is:

pawn Код:
if(!strcmp("/pm", cmdtext, true))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
    new id = strval(tmp);
    gMessage = strrest(cmdtext,idx);
    if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");
    GetPlayerName(id,iName,sizeof(iName));
    GetPlayerName(playerid,pName,sizeof(pName));
    format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
    SendClientMessage(playerid,0xFFD720FF,Message);
    format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
    SendClientMessage(id,0xFFD720FF,Message);
    PlayerPlaySound(id,1085,0.0,0.0,0.0);
    return 1;
}
Also you will need these functions:

https://sampwiki.blast.hk/wiki/Strtok
https://sampwiki.blast.hk/wiki/Functiontrrest


Read this article about creating commands, I'm sure it's going to help you:

https://sampwiki.blast.hk/wiki/Creating_Commands
Reply


Messages In This Thread
Pm command - by Goldino - 18.11.2012, 13:38
Re: Pm command - by RanSEE - 18.11.2012, 13:39
Re: Pm command - by [HK]Ryder[AN] - 18.11.2012, 13:39
Re: Pm command - by [KHK]Khalid - 18.11.2012, 13:41
Re: Pm command - by Goldino - 18.11.2012, 13:42
Re: Pm command - by XtremeR - 18.11.2012, 13:44
Re: Pm command - by Goldino - 18.11.2012, 13:47
Re: Pm command - by Konstantinos - 18.11.2012, 13:58
Re: Pm command - by 2KY - 18.11.2012, 13:59
Re: Pm command - by [KHK]Khalid - 18.11.2012, 14:11

Forum Jump:


Users browsing this thread: 1 Guest(s)