Script Error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Script Error (
/showthread.php?tid=393509)
Script Error -
Goldino - 18.11.2012
Hey guys, I added a /w command to my script
Here is how it looks like
Код:
if(strcmp(cmdtext,"/w",true)==0)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid,0xFF0000FF,"USAGE: /w (msg)");
return 1;
}
new output[150];
new pname[24];
GetPlayerName(playerid, pname, 24);
strmid(output,cmdtext,2,strlen(cmdtext));
format(string, sizeof(string), "(WHISPER): %s [%d] %s",pname,playerid,output);
printf("%s", string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 20)
{
format(string, sizeof(string), "(WHISPER): %s [%d] %s",pname,playerid,output);
SendClientMessage(i,0xF2FF00FF,string);
}
}
return 1;
}
But when I compile it, this comes up...
Код:
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1298) : error 017: undefined symbol "string"
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1298) : error 017: undefined symbol "string"
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1298) : error 029: invalid expression, assumed zero
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1298) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
I hope you guys could help me. Please
Thanks
Re: Script Error -
Plovix - 18.11.2012
Re: Script Error -
RACGaming - 18.11.2012
EDIT://Too late
You forgot
Use this:
pawn Код:
if(strcmp(cmdtext,"/w",true)==0)
{
if(strlen(cmdtext) <= 3)
{
SendClientMessage(playerid,0xFF0000FF,"USAGE: /w (msg)");
return 1;
}
new string[128];
new output[150];
new pname[24];
GetPlayerName(playerid, pname, 24);
strmid(output,cmdtext,2,strlen(cmdtext));
format(string, sizeof(string), "(WHISPER): %s [%d] %s",pname,playerid,output);
printf("%s", string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 20)
{
format(string, sizeof(string), "(WHISPER): %s [%d] %s",pname,playerid,output);
SendClientMessage(i,0xF2FF00FF,string);
}
}
return 1;
}
Re: Script Error -
YoYo123 - 18.11.2012
You didn't create a 'string' variable. Add this line:
Re: Script Error -
Goldino - 18.11.2012
RACGaming,
I sent you a Private Message... Read it plz.