12.08.2012, 03:38
Quote:
Please give me full code for /me and /ooc with zcmd...
Thank you +Rep if you helped |
For /me and /ooc you will need to use something called Prox Detector. This is something which calculates your distance between players and localizes your chat. For example, it'd make your /me commands visible only to players near you. Here is a prox detector stock:
Код:
stock ProxDetector(Float:radi, playerid, string[],color) //ready the stock { new Float:x,Float:y,Float:z; //define x,y,z to be later used. GetPlayerPos(playerid,x,y,z); //get the position of yourself and store it in x,y,z foreach(Player,i) //create a loop for all players. { if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) //check if players are in radius of you { if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) //check if they're in your virtual world { SendClientMessage(i,color,string); //send the message } } } }
Код:
#include <foreach>
Код:
CMD:me(playerid, params[]) //use zcmd to initiate command { new string[128], //set up a string action[100]; //set up the action name[100]; //Set up name if(sscanf(params, "s[100]", action)) //check if they've typed it properly. { SendClientMessage(playerid, green, "<System> To use this command, type /me followed by your characters action."); return 1; } else { GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s %s", name, action); ProxDetector(15, playerid, string, COLOR_PURPLE); //finally send it to nearby players } return 1; }
/ooc can be done easily if you understand this.