SAY -
geerdinho8 - 24.02.2010
I want to make if you type a text only players who are close are reading and seeing it, this is the script:
Код:
new string[256];
new sendername[MAX_PLAYER_NAME];
new sendername2[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
cmd = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername2, sizeof(sendername));
public OnPlayerText(playerid, text[])
{
format(string,sizeof(string), "Command: %s: %s", sendername2, cmdtext);
SendCmdMessage(COLOR_YELLOW, string);
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))
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);
SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 10000);
return 1;
}
I get this errors:
Код:
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(17) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(30) : error 021: symbol already defined: "cmd"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(32) : error 010: invalid function or declaration
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(36) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(39) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(40) : error 017: undefined symbol "idx"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(40) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(40) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test.pwn(40) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
8 Errors.
Re: SAY -
aircombat - 24.02.2010
1.delete new cmd[256];
2. show me line 17
3. add this : new idx;
________
MARIJUANA MEDICAL
Re: SAY -
geerdinho8 - 24.02.2010
Line 17: new tmp[192];
Re: SAY -
adsy - 24.02.2010
why is tmp larger than 128?
Re: SAY -
VonLeeuwen - 24.02.2010
Just delete the 'new tmp[192];'
Re: SAY -
geerdinho8 - 24.02.2010
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(31) : error 010: invalid function or declaration
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(37) : error 017: undefined symbol "ProxDetector"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(39) : error 017: undefined symbol "SetPlayerChatBubble"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(43) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(45) : error 017: undefined symbol "gdebug"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(46) : warning 217: loose indentation
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(4

: error 017: undefined symbol "ReadCMD"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(4

: warning 215: expression has no effect
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(4

: error 001: expected token: ";", but found "]"
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(4

: error 029: invalid expression, assumed zero
C:\Documents and Settings\Eigenaar\Bureaublad\LVRPG\gamemodes\test. pwn(4

: fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
8 Errors.
This is the hole script now:
Код:
#include <a_samp>
forward SendCmdMessage(color, string[]);
#define COLOR_YELLOW 0xFFFF00AA
public OnGameModeInit()
{
LimitGlobalChatRadius(10.0);
return 1;
}
new tmp[256];
new cmd[256];
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
{
GetPlayerName(playerid,tmp,24);
format(tmp,192,"(( %s: %s ))",tmp,cmdtext[5]);
SendClientMessageToAll(0xFF4444FF,tmp);
return 1;
}
return 0;
}
new string[256];
new sendername[MAX_PLAYER_NAME];
new sendername2[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new idx;
cmd = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername2, sizeof(sendername));
public OnPlayerText(playerid, text[])
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Says %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 10000);
return 1;
}
public SendCmdMessage(color, string[])
{
if (gdebug >= 1){printf("DEBUG SendCmdMessage()");}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1 && ReadCMD[i] == 1)
{
SendClientMessage(i, color, string);
}
}
}
Re: SAY -
geerdinho8 - 24.02.2010
yes i did, because i didnt understand enything about it
Re: SAY -
geerdinho8 - 24.02.2010
But please help me
Re: SAY -
VonLeeuwen - 24.02.2010
http://pawn.pastebin.com/3LxdwGRD
Fixed, the only thing you have to do, is to define the colors.
Re: SAY -
geerdinho8 - 24.02.2010
Thnx, but now it says in chat and in say,
how can i put out the chat?