/w command error +REP
#1

Hi guys, I hope you can help me with this one.

I have added a /w command to my script but it doesn't work.

Here is the command:

Код:
 	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, 0xFFFF00FF,string);
		    }
	    }
	    return 1;
    }

And I get this error:

Код:
C:\Documents and Settings\Danny\My Documents\GTA SA Server\gamemodes\cnr.pwn(1491) : error 017: undefined symbol "GetDistanceBetweenPlayers"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Can you please try and help me. Please try to explain properly
Reply
#2

You don't have the function GetDistanceBetweenPlayers in your script, so when you call it the compiler cannot find it (its undefined because you haven't defined it ).
Reply
#3

Yes but how do I fix it?
Reply
#4

You need to find that function and put it in your script.

https://sampforum.blast.hk/showthread.php?tid=314543

****** is your friend.
Reply
#5

This is from my script change somethings if u got errors
pawn Код:
dcmd_w(playerid,params[])
{
    new string[128];
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}USAGE: /w(whisper) (msg)");
        return 1;
    }
    format(string, sizeof(string), "Whisper: %s(%d): %s",PlayerName(playerid),playerid,params);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10)
        {
            format(string, sizeof(string), "Whisper: %s(%d): %s",PlayerName(playerid),playerid,params);
            SendClientMessage(i,COLOR_YELLOW,string);
        }
    }
    return 1;
}
Reply
#6

Still dont work
Reply
#7

Dou you use DCMD ?

pawn Код:
dcmd_w(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /(w)hisper (message)");
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    new string[128];
    format(string, sizeof(string), "(WHISPER) %s (%d): %s", pName, playerid, params);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 10.0, x, y, z))
        {
            SendClientMessage(i, 0xFFFFFFFF, string);
        }
    }
    return 1;
}

dcmd_whisper(playerid, params[]) return dcmd_w(playerid, params);
Reply
#8

No I dont use dcmd
Reply
#9

Код:
 CMD:w(playerid, params[])
{
	new giveplayerid, whisper[128];

	if(gPlayerLogged{playerid} == 0)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
		return 1;
	}
	if(sscanf(params, "us[128]", giveplayerid, whisper))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/w)hisper [playerid] [text]");
		return 1;
	}
Reply
#10

@Goldino No I dont use dcmd

Then use it

pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)