Posts: 662
Threads: 102
Joined: Sep 2010
Reputation:
0
26.10.2010, 06:39
(
Последний раз редактировалось [WSF]ThA_Devil; 26.10.2010 в 06:58.
)
please help! how to make /me with dcmd!
im not so pro scripter..... so plz help me....
Posts: 6,129
Threads: 36
Joined: Jan 2009
Use
zcmd. It's a lot easier to use, and it's more efficient.
pawn Код:
CMD:me(playerid, params[]) { // Creating the command.
if(isnull(params)) { // Checking if the player added anything after '/me'
// They didn't. We'll show them the usage of the command
SendClientMessage(playerid, 0xFF0000FF, "Usage: /me [action]"); // Sending them the usage as a message
}
else { // They did the opposite here. They did type something.
new
_playerNameSz[MAX_PLAYER_NAME], // Creating a variable to get the players name
_msgSz[128]; // 128 is the maximum limit of text per line
GetPlayerName(playerid, _playerNameSz, MAX_PLAYER_NAME); // Get the players name
format(_msgSz, sizeof(_msgSz), "* %s %s", _playerNameSz, _msgSz); // Format the message
SendClientMessageToAll(0xFF0000FF, _msgSz); // Send the /me message to everyone
}
return 1; // Return 1 so zcmd acknowledges that the command worked
}
Excuse the name for strings and whatnot, it's the coding style I use, but zcmd is pretty simple to use. That's literally all you have to add for your /me command, other than '#include <zcmd>' at the top of your script.
Posts: 662
Threads: 102
Joined: Sep 2010
Reputation:
0
ok thx! i ll try to learn zcmd!
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by [WSF]ThA_Devil
wtf?
pawn Код:
warning 203: symbol is never used: "me"
|
Have you included zcmd? You don't need to enclose the code in any other functions.
Posts: 662
Threads: 102
Joined: Sep 2010
Reputation:
0
when i do /me cmd it just shows my username and thats all!
Posts: 6,129
Threads: 36
Joined: Jan 2009
Sorry, replace:
pawn Код:
format(_msgSz, sizeof(_msgSz), "* %s %s", _playerNameSz, _msgSz);
with
pawn Код:
format(_msgSz, sizeof(_msgSz), "* %s %s", _playerNameSz, params);