Need help with /fakechat
#1

I use zcmd. When I do /fakechat id text, it shows always the same user(no matter the id), and no text. Always "Sameplayer:"

Please help o.O

Quote:

CMD:fakechat(playerid, params[])
{
new Player, xChat[24];
if(!strlen(params)) return SendClientMessage(playerid, COLOUR_RED, "Will send a fake message of the specified player!");
else
{
if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOUR_RED, "This player is not connected");

SendClientMessage(playerid, COLOUR_RED, "Fake chat sent!");

SendPlayerMessageToAll(Player, xChat);
}
return 1;
}

Reply
#2

I use sscanf. I'm new at this and I'm not sure what you mean. Could someone rewrite the command so it would work? I would deeply appreciate it!
Reply
#3

As stated, I'm new

Quote:

CMD:fakechat(playerid, params[])
{
new Player, xChat[24];
if(sscanf(params)) return SendClientMessage(playerid, COLOUR_RED, "Will send a fake message of the specified player!");
else
{
if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOUR_RED, "This player is not connected");

SendClientMessage(playerid, COLOUR_RED, "Fake chat sent!");

SendPlayerMessageToAll(Player, xChat);
}
return 1;
}

Would this work any better?
Reply
#4

pawn Код:
CMD:fakechat(playerid,params[])
{
   new target;
   new ftext;
   new string[256];
   new Lname[MAX_PLAYER_NAME];
   if(sscanf(params,"us[128]",target,ftext)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /fakechat [playerid] [text]");
   GetPlayerName(target,Lname,sizeof(Lname));
   format(string,sizeof(string),"%s:{FFFFFF}%s", Lname, ftext);
   new tcolor;
   tcolor = GetPlayerColor(target);
   SendClientMessageToAll(tcolor,string);
   SendClientMessage(playerid, 0xFF0000, "Fake chat successfully sent!");
   return 1;
}
Try this, but you'll need sscanf2.
Reply
#5

Quote:
Originally Posted by [xB]Lordz
Посмотреть сообщение
pawn Код:
CMD:fakechat(playerid,params[])
{
   new target;
   new ftext;
   new string[256];
   new Lname[MAX_PLAYER_NAME];
   if(sscanf(params,"us[128]",target,ftext)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /fakechat [playerid] [text]");
   GetPlayerName(target,Lname,sizeof(Lname));
   format(string,sizeof(string),"%s:{FFFFFF}%s", Lname, ftext);
   new tcolor;
   tcolor = GetPlayerColor(target);
   SendClientMessageToAll(tcolor,string);
   SendClientMessage(playerid, 0xFF0000, "Fake chat successfully sent!");
   return 1;
}
Try this, but you'll need sscanf2.
Server crashed.
Reply
#6

Server won't be crashed.
Use latest sscanf.
Sscanf2 plugin and also include it.
Reply
#7

I have on top #include <sscanf2>
Reply
#8

When I use /fakechat, the server freezes/crashes. Nothing is wrong until I use the command.
Reply
#9

pawn Код:
CMD:fakechat(playerid,params[])
{
   new target;
   new ftext[128];// thats the problem
   new string[256];
   new Lname[MAX_PLAYER_NAME];
   if(sscanf(params,"us[128]",target,ftext)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /fakechat [playerid] [text]");
   GetPlayerName(target,Lname,sizeof(Lname));
   format(string,sizeof(string),"%s:{FFFFFF}%s", Lname, ftext);
   new tcolor;
   tcolor = GetPlayerColor(target);
   SendClientMessageToAll(tcolor,string);
   SendClientMessage(playerid, 0xFF0000, "Fake chat successfully sent!");
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)