#include <foreach> #include <ZCMD> #include <sscanf2>
stock strreplace(string[], find, replace) { for(new i=0; string[i]; i++) { if(string[i] == find) { string[i] = replace; } } }
stock ProxDetector(Float:radi, playerid, string[],color) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); foreach(Player,i) { if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) { SendClientMessage(i,color,string); } } }
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
foreach(Player,i) { if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) { SendClientMessage(i,color,string); } }
stock GetName(playerid) { new name[24]; GetPlayerName(playerid, name, sizeof(name)); strreplace(name, '_', ' '); return name; }
new name[24];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
return name;
CMD:me(playerid, params[]) { new string[128], action[100]; if(sscanf(params, "s[100]", action)) { SendClientMessage(playerid, -1, "USAGE: /me [action]"); return 1; } else { format(string, sizeof(string), "* %s %s", GetName(playerid), action); ProxDetector(30, playerid, string, COLOR_PURPLE); } return 1; } if(sscanf(params, "s[100]", action)) { SendClientMessage(playerid, -1, "USAGE: /me [action]"); return 1; }
else { format(string, sizeof(string), "* %s %s", GetName(playerid), action); ProxDetector(30, playerid, string, COLOR_PURPLE); }
format(string, sizeof(string), "* %s %s", GetName(playerid), action);
ProxDetector(30, playerid, string, COLOR_PURPLE);
CMD:do(playerid, params[]) { new string[128], action[100]; if(sscanf(params, "s[100]", action)) { SendClientMessage(playerid, -1, "USAGE: /do [action]"); return 1; } else { format(string, sizeof(string), "* %s (( %s ))", action, GetName(playerid)); ProxDetector(30, playerid, string, COLOR_PURPLE); } return 1; }
CMD:shout(playerid, params[]) { new string[128], shout[100]; if(sscanf(params, "s[100]", shout)) { SendClientMessage(playerid, -1, "USAGE: /(s)hout [message]"); return 1; } else { format(string, sizeof(string), "%s shouts: %s!",GetName(playerid),shout); ProxDetector(50.0, playerid, string, -1); } return 1; }
ProxDetector(50.0, playerid, string, -1);
CMD:s(playerid, params[]) return cmd_shout(playerid, params);
CMD:b(playerid, params[]) { new string[128], text[100]; if(sscanf(params, "s[100]", text)) return SendClientMessage(playerid, -1, "USAGE: /b [TEXT]"); format(string, sizeof(string), "(( %s says: %s ))", GetName(playerid), text); ProxDetector(30.0, playerid, string, COLOR_GREY); return 1; }
new string[128], text[100];
if(sscanf(params, "s[100]", text)) return SendClientMessage(playerid, -1, "USAGE: /b [TEXT]");
format(string, sizeof(string), "(( %s says: %s ))", GetName(playerid), text); ProxDetector(30.0, playerid, string, COLOR_GREY);
CMD:me(playerid, params[])
{
new
string[128];
if (isnull(params))
{
SendClientMessage(playerid, -1, "USAGE: /me [action]");
}
else
{
format(string, sizeof(string), "* %s %s", GetName(playerid), params);
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
return 1;
}
stock ProxDetector(Float:radi, playerid, string[],color) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); foreach(Player,i) { if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) { SendClientMessage(i,color,string); } } }
stock ProxDetector(Float:radio, playerid, string[], color) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); foreach(Player,i) { if((IsPlayerInRangeOfPoint(i,radi,x,y,z)) && ((GetPlayerVirtualWorld(playerid)) == (GetPlayerVirtualWorld(i))) { SendClientMessage(i,color,string); } } }
C:\Users\Jan\Desktop\GM\gamemodes\NewOne.pwn(410) : error 035: argument type mismatch (argument 4) C:\Users\Jan\Desktop\GM\gamemodes\NewOne.pwn(414) : error 010: invalid function or declaration C:\Users\Jan\Desktop\GM\gamemodes\NewOne.pwn(417) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors.
stock GetName(playerid) { new name[24]; GetPlayerName(playerid, name, sizeof(name)); strreplace(name, '_', ' '); return name; } |
stock GetName(playerid) { new name[24]; GetPlayerName(playerid, name, sizeof(name)); return strreplace(name, '_', ' '); } |
Some of the methods are outdated and can be replaced with newer ones, |
Hey, I have encountered a problem while using this, I've been googling a lot(Perhaps not good enough) but I haven't found a solution. Any line that has the %s in it, doesn't display my name, so when I /shout, it just does: shouts: blablabla Any help, please? |
format(string, sizeof(string), "%s shouts: %s!",GetName(playerid),shout); ProxDetector(50.0, playerid, string, -1);
Make sure that the "%s" is in the inverted commas...
Another thing is to make sure that you are getting the players name Code:
format(string, sizeof(string), "%s shouts: %s!",GetName(playerid),shout); ProxDetector(50.0, playerid, string, -1); |