29.10.2009, 09:43
Hey, i made the /pm command for 0.3, but it seem like i'm missing something with the CallLocalFunction.
The script :
The script :
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/pm", true) == 0) { new x_nr[256]; x_nr = strtok(cmdtext, idx); new recieverid = strval(x_nr); new text[MAX_STRING]; if(!strlen(x_nr)) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a valid player ID!"); if(cmdtext[5] == 0) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a message!"); if(!IsPlayerConnected(recieverid)) return SendClientMessage(playerid, 0x00C8C8FF, "Enter a valid player ID!"); if(recieverid == playerid) return SendClientMessage(playerid, 0x00C8C8FF, "You cannot PM yourself!"); if(strlen(x_nr) == 1) { format(text,sizeof(text), "%s", cmdtext[6]); } if(strlen(x_nr) == 2) { format(text,sizeof(text), "%s", cmdtext[7]); } if(strlen(x_nr) == 3) { format(text,sizeof(text), "%s", cmdtext[8]); } CallLocalFunction("OnPlayerPrivmsg","playerid,recieverid,text[]"); return 1; } }