HELP with /b -
Matej_ - 31.01.2011
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);
}
Re: HELP with /b -
bartje01 - 31.01.2011
new sendername[MAX_PLAYER_NAME]; ?
Re: HELP with /b - [03]Garsino - 31.01.2011
Quote:
Originally Posted by bartje01
new sendername[MAX_PLAYER_NAME]; ?
|
^ Before GetPlayerName.
Also, why are you still using strcmp for commands like that? =/
Re: HELP with /b -
Matej_ - 31.01.2011
Quote:
Originally Posted by bartje01
new sendername[MAX_PLAYER_NAME]; ?
|
Now i get 10-15 errors.
Re: HELP with /b -
bartje01 - 31.01.2011
new idx[80]; ?
Re: HELP with /b - [03]Garsino - 31.01.2011
Quote:
Originally Posted by Matej_
Now i get 10-15 errors.
|
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;
}
Re: HELP with /b -
Audiophr3ak - 31.01.2011
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;
}
Re: HELP with /b -
Matej_ - 31.01.2011
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.
Re: HELP with /b - [03]Garsino - 31.01.2011
You need YCMD / ZCMD as I mentioned in my post. And this code goes outside any callback and other custom functions.