need help with whisper
#1

hey guys, i ran into a little problem when making my whisper command
i get error 017 : undefined symbol "params" when compiling

i have sscanf2 included and also foreach,

here is my code

Код:
        if(!strcmp(cmdtext,"/whisper",true))
        {
        
    new str[128], msg[128], Float:Pos[3];
    if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_ERROR, "Syntax: /w(hisper) (text)");
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    format(str, sizeof(str), "Whisper: %s(%d): {FFFFFF}%s", GetName(playerid), playerid, msg);
    SendClientMessage(playerid, COLOR_LIME, str);
    foreach(Player, i)
    {
        if(IsPlayerInRangeOfPoint(i, 20.0, Pos[0], Pos[1], Pos[2]) && i != playerid)
        {
		    format(str, sizeof(str), "Whisper: %s(%d): {FFFFFF}%s", GetName(playerid), playerid, msg);
            SendClientMessage(i, COLOR_LIME, str);
            return 1;
        }
        else if(!IsPlayerInRangeOfPoint(i, 20.0, Pos[0], Pos[1], Pos[2]) && i != playerid)
        {
			SendClientMessage(playerid, COLOR_ERROR, "Whispering to Yourself is Weird!");
            return 1;
		}
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:whisper(playerid,params[])
{
       
    new str[128], msg[128], Float:Pos[3];
    if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, COLOR_ERROR, "Syntax: /w(hisper) (text)");
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    format(str, sizeof(str), "Whisper: %s(%d): {FFFFFF}%s", GetName(playerid), playerid, msg);
    SendClientMessage(playerid, COLOR_LIME, str);
    foreach(Player, i)
    {
        if(IsPlayerInRangeOfPoint(i, 20.0, Pos[0], Pos[1], Pos[2]) && i != playerid)
        {
            format(str, sizeof(str), "Whisper: %s(%d): {FFFFFF}%s", GetName(playerid), playerid, msg);
            SendClientMessage(i, COLOR_LIME, str);
            return 1;
        }
        else if(!IsPlayerInRangeOfPoint(i, 20.0, Pos[0], Pos[1], Pos[2]) && i != playerid)
        {
            SendClientMessage(playerid, COLOR_ERROR, "Whispering to Yourself is Weird!");
            return 1;
        }
    }
    return 1;
}
Reply
#3

yeh by the looks of it, i have to use zcmd. thanks
Reply
#4

It's best re-writing the whole of your code to ZCMD or YCMD, whichever suits your likes. It's way more efficient and easier to code and understand.

But seriously, I can't believe that it's 2014 and people are still using strcmp...
Reply
#5

yeah i know, i alternate between both in my script, just a weird thing i do :P

anyways i fixed this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)