13.09.2015, 20:50
Any idea guys, how to script cmds such as /me /do /w(hisper)...
Any help is welcome, ((tuts are welcome either))
Any help is welcome, ((tuts are welcome either))
CMD:me(playerid, params[])
{
new string[128];
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /me [action]");
{
format(string, sizeof(string), "* %s %s", RPN(playerid), params);
}
else
{
format(string, sizeof(string), "* %s %s", PlayerInfo[playerid][aMask], params);
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
CMD:do(playerid, params[])
{
new string[128];
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /me [action]");
{
format(string, sizeof(string), "* %s (( %s ))", params, RPN(playerid));
}
else
{
format(string, sizeof(string), "* %s (( %s ))", params, PlayerInfo[playerid][aMask]);
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
stock SendRangeMessage(playerid,color,const text[],Float:range)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=GetPlayerPoolSize()+1; --i!=-1;)
{
if(!IsPlayerConnected(i) || IsPlayerNPC(i) || !IsPlayerInRangeOfPoint(i,range,x,y,z)) continue;
SendClientMessage(i,color,text);
}
return 1;
}
//Usage for /me:
CMD:me(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Type: /me [Text]");
new string[145];
GetPlayerName(playerid,string,MAX_PLAYER_NAME);
format(string,sizeof(string),"* %s %s",string,params);
SendRangeMessage(playerid,purple,string,25.0); //Range 25 feet...and color purple
return 1;
}
SendRangeMessage();
//Usage for /me:
CMD:me(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Type: /me [Text]");
new string[145];
GetPlayerName(playerid,string,MAX_PLAYER_NAME);
format(string,sizeof(string),"* %s %s",string,params);
SendRangeMessage(playerid,purple,string,25.0); //Range 25 feet...and color purple
return 1;
}
//Usage for /me:
CMD:me(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid,-1,"Type: /me [Text]");
new string[145];
GetPlayerName(playerid,string,MAX_PLAYER_NAME);
format(string,sizeof(string),"* %s %s",string,params);
SendClientMessageToAll(purple, string);
return 1;
}
|
I've tested it and it works fine, although I've got a few questions.
1: What does "IsPlayerNPC" mean? 2: it's really my first time to see the "continue;" thingy, what is meant with that? 3: What does "GetPlayerPoolSize()+1; --i!=-1" do/mean? I know it's for the loop)) 4: If I remove the PHP код:
5: Really appreciated!! I'll surely rep+ you later. |
