Little help
#1

I get the next errors:
Код:
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(110) : error 017: undefined symbol "cmd"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(112) : error 017: undefined symbol "sendername"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(112) : error 017: undefined symbol "sendername"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(112) : error 029: invalid expression, assumed zero
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(112) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
5 Errors.

This is the command that I want to make, it's /me command for RP server.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/me", true) == 0)
	{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		GiveNameSpace(sendername);
		if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
		new length = strlen(cmdtext);
        if(Mute[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
				return 1;
			}
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
		    idx++;
		}
		new offset = idx;
		new result[128];
	    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: /me [action]");
			return 1;
		}
		format(string, sizeof(string), "* %s %s", sendername, result);
		ProxDetector(30.0, playerid, string,                            COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		//printf("%s", string);
		return 1;
	}
}
Line 110 is:
Код:
if(strcmp(cmd, "/me", true) == 0)
Reply
#2

i still dont understand why ppl always copy&paste for a single thing.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], sendername[MAX_PLAYER_NAME];
    if(strcmp(cmd, "/me", true) == 0)
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        GiveNameSpace(sendername);
        if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
        new length = strlen(cmdtext);
        if(Mute[playerid] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
                return 1;
            }
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[128];
        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: /me [action]");
            return 1;
        }
                GetPlayerName(playerid,sendername,128);
        format(string, sizeof(string), "* %s %s", sendername, result);
        ProxDetector(30.0, playerid, string,                            COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        //printf("%s", string);
        return 1;
Enjoy.
}
}
Reply
#3

Код:
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(117) : error 017: undefined symbol "GiveNameSpace"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(118) : error 017: undefined symbol "PlayerInfo"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(118) : warning 215: expression has no effect
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(118) : error 001: expected token: ";", but found "]"
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(118) : error 029: invalid expression, assumed zero
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(118) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#4

That happens when you copy & paste, sorry.
Reply
#5

How to fix it ?
Reply
#6

Remove the lines where are the errors.
Reply
#7

I think this will doesn't help ... how to make the /me command ? I want it for players near by you ...
Reply
#8

pawn Код:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                {
                    SendClientMessage(i, col5, string);
                }
            }
        }
    }
    return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
        ProxDetector(30.0, playerid, str, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
        return 1;
    }
Credits to WIKI.
EDIT: I just noticed a little error. /me code updated.

This code would send a message to near players
Reply
#9

Hmmm...Why using ProxDetector for /me command?? When you can use NearByMessage function
And I suggest you to use ZCMD.

pawn Код:
COMMAND:me(playerid, params[])
{
    new string[128], MText[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(!sscanf(params, "s[128]",MText))
    {
        format(string, sizeof(string), "** %s %s", name, params[0]);
        NearByMessage(playerid, 0xBC43B9FF, string);
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "[INFO]: /me [Action]");
    return 1;
}
Function:
pawn Код:
forward NearByMessage(playerid, colour, string[]);
public NearByMessage( playerid, colour, string[])
{
    new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx( i ) && IsPlayerSpawned( playerid ) )
        {
            GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
            if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
            {
                if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
                {
                    SendClientMessage(i, colour, string);
                }
            }
        }
    }
    return true;
}
Reply
#10

When I try with ProxDetector I got this error:
Код:
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(205) : error 017: undefined symbol "ProxDetector"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
How to fix it ?
Reply
#11

put return 0; at onplayertext not return 1;
Reply
#12

Ok, thanks for everything
What about the /do command, well /me is added, but I need and /do but I don't know how to write it
Reply
#13

base on /me
Reply
#14

I have no idea ... lol
Код:
if(!strcmp(cmdtext, "/do", true, 3)) // 3 is the length of /do
	{
    if(!cmdtext[3])return SendClientMessage(playerid, COLOR_GREY, "USAGE: /do [text]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    ProxDetector(30.0, playerid, str, COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
    return 1;
	}
I have to change something in format(str, sizeof(str), "* %s %s", str, cmdtext[4]); ,but what ?
It should be: text ((Player_Name))
Reply
#15

format(str, sizeof(str), "* %s (( %s ))", cmdtext[4], str);
Reply
#16

IT WORKS ... THANK YOU!!
And again I have to ask about the OOC chat
Format should be
[OOC] Your_Name: Your Message
Reply
#17

if(!strcmp(cmdtext, "/ooc", true, 3))
{
if(!cmdtext[3])return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ooc [text]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "*[OOC] %s %s", str, cmdtext[4]);
SendClientMessageToAll(str, COLOR_PINK);
return 1;
}
Reply
#18

Код:
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\Testovo\gamemodes\testov.pwn(253) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#19

Код:
   if(!strcmp(cmdtext, "/b", true, 3))
    {
    if(!cmdtext[3])return SendClientMessage(playerid, COLOR_GREY, "USAGE: /b [text]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "*[OOC] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(str, COLOR_GOOCCHAT);
    return 1;
    }
What is wrong ?
Reply
#20

use this. BTW you didn't show us your error line

pawn Код:
if(!strcmp(cmdtext, "/b", true, 3))
{
   new result[128];
   if(!strlen(result))
   {
    SendClientMessage(playerid, COLOR_GREY, "USAGE: /b [TEXT]");
    return 1;
    }
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "*[OOC] %s %s", str, cmdtext[4]);
    SendClientMessageToAll(str, COLOR_GOOCCHAT);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)