HELP with /b
#1

So i made a /b command for my roleplay but i get 3 errors
pawn Код:
undefined symbol "sendername"
Here is the code:
pawn Код:
if(strcmp(cmdtext, "/b", true) == 0)
    {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
                return 1;
            }
            format(string, sizeof(string), "%s Says: (( %s ))", sendername, result);
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            printf("%s", string);
        }
Reply
#2

new sendername[MAX_PLAYER_NAME]; ?
Reply
#3

Quote:
Originally Posted by bartje01
Посмотреть сообщение
new sendername[MAX_PLAYER_NAME]; ?
^ Before GetPlayerName.

Also, why are you still using strcmp for commands like that? =/
Reply
#4

Quote:
Originally Posted by bartje01
Посмотреть сообщение
new sendername[MAX_PLAYER_NAME]; ?
Now i get 10-15 errors.

pawn Код:
undefined symbol "idx
Reply
#5

new idx[80]; ?
Reply
#6

Quote:
Originally Posted by Matej_
Посмотреть сообщение
Now i get 10-15 errors.

pawn Код:
undefined symbol "idx
You didn't define idx? Isn't that pretty obvious, lol.
Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Also, why are you still using strcmp for commands like that? =/
YCMD / ZCMD
pawn Код:
CMD:b(playerid, params[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
    if(strlen(param) > 80) return SendClientMessage(playerid, COLOR_GRAD2, "Message is too long.");
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(string, sizeof(string), "%s Says: (( %s ))", name, params);
    ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
    return 1;
}
Reply
#7

stock PlayerToPlayer(playerid,targetid,Float:distance)
{
new Float, Float:y, Float:z; GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z) )
{
return true;
}
return false;
}

CMD(playerid, params[])
{
new text[256];
if(!sscanf(params, "s[256]", text))
{
for(new i; i<MAX_PLAYERS; i++)
{
if((PlayerToPlayer(playerid,i,20))&&(GetPlayerVirt ualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
new msg[256], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
format(msg, sizeof(msg), "%s (OOC): %s", name, text); SendClientMessage(i, 0xFFFFFFAA, msg);
}
}
}
else{SendClientMessage(playerid, 0xB3D3FBAA, "[Chat info]: Usage: /o <text>.");}
return 1;
}
Reply
#8

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
You didn't define idx? Isn't that pretty obvious, lol.


YCMD / ZCMD
pawn Код:
CMD:b(playerid, params[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /b [local ooc chat]");
    if(strlen(param) > 80) return SendClientMessage(playerid, COLOR_GRAD2, "Message is too long.");
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(string, sizeof(string), "%s Says: (( %s ))", name, params);
    ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
    return 1;
}
I get 5 errors:
pawn Код:
... error 017: undefined symbol "b"
... warning 217: loose indentation
... error 017: undefined symbol "isnull"
... error 017: undefined symbol "COLOR_GRAD2"
... error 017: undefined symbol "params"
... error 017: undefined symbol "ProxDetector"
... warning 225: unreachable code
... warning 217: loose indentation
... warning 203: symbol is never used: "CMD"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#9

You need YCMD / ZCMD as I mentioned in my post. And this code goes outside any callback and other custom functions.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)