Help me please - 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: Help me please (
/showthread.php?tid=393535)
Help me please -
Goldino - 18.11.2012
I added a /w command to my server, but a error comes up. Please try and fix it
Heres the Pawn Code:
Код:
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;
}
And heres the error message:
Код:
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1303) : error 017: undefined symbol "GetDistanceBetweenPlayers"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Could you please fix it
Re: Help me please -
Plovix - 18.11.2012
You don't have defined GetDistanceBetweenPlayers.Try this:
Код:
stock Float:GetDistanceBetweenPlayers(playerid,targetplayerid)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid)) {
return -1.00;
}
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(targetplayerid,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Re: Help me please -
Goldino - 18.11.2012
I have tried what you said, but this comes up:
Код:
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1478) : warning 208: function with tag result used before definition, forcing reparse
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
PLZ HELP ME!!!