03.06.2012, 06:05
Код:
cmd(pm, playerid, params[]) { new targetid, message[128]; if(sscanf(params, "us", targetid, message)) return SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [message]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Error: Player is offline."); new str1[128], str[128], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME] GetPlayerName(targetid, receiver, sizeof(receiver)); GetPlayerName(playerid, sender, sizeof(sender)); format(str1, sizeof(str1), "PM to %s(%d): %s", receiver, targetid, message); format(str2, sizeof(str2), "PM from %s(%d): %s", sender, playerid, message); SendClientMessage(playerid, -1, str1); SendClientMessage(targetid, -1, str2); return 1; }
and i am using sscanf in this example.
note that i am also new to scripting, miatakes may have been made.
edit; fixed some errors