[Help] : error 010: invalid function or declaration
#1

Hello,

I need help, I've been trying to make this command that can only be used my admin levels 3 and up; I'm not a scripter, just been trying stuff out and it hasn't been going so well.

It gives 3 errors when I attempt to compile.

C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107199) : error 010: invalid function or declaration
C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107201) : error 010: invalid function or declaration
C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107203) : error 010: invalid function or declaration

Here's how it looks in the script:

Код:
if(strcmp("/acords", cmdtext, true, 10) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pAdmin] >= 3)
	    	{
	    	    SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
	    	    SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
	    	}
		}
Can someone please help me?
Reply
#2

On the code you put there's missing a bracket }
try this:
Код:
if(strcmp("/acords", cmdtext, true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pAdmin] >= 3)
	    	{
	    	    SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
	    	    SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
	    	}
	    }
        }
Reply
#3

Quote:
Originally Posted by Sk1lleD
Посмотреть сообщение
On the code you put there's missing a bracket }
try this:
Код:
if(strcmp("/acords", cmdtext, true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pAdmin] >= 3)
	    	{
	    	    SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
	    	    SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
	    	}
	    }
        }
Same errors:
C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107199) : error 010: invalid function or declaration
C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107201) : error 010: invalid function or declaration
C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107203) : error 010: invalid function or declaration

I didn't do the command from scratch, I took it from the /helperhelp or something like that (forgot) and edited it. I know the [pAdmin] is correct and the <= (equal or greater) is correct, did It mess up somewhere in the command.
Reply
#4

Made it to ZCMD, do not forget to #include <zcmd>
pawn Код:
CMD:acords(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
            SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
        }
    }
    return 1;
}
Sorry if you don't want in ZCMD but it's seriously easier..

EDIT: Are you sure you got an enum for pAdmin? And the player info and all?
Reply
#5

Is it like this?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/acords", cmdtext, true) == 0) // it's not 10 lenght...
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 3)
            {
                SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
                SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
                return 1;
            }
        }
    }
    // more commands
    return 0;
}
And please show us the line the error comes from.
Reply
#6

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
Made it to ZCMD, do not forget to #include <zcmd>
pawn Код:
CMD:acords(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
            SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
        }
    }
    return 1;
}
Sorry if you don't want in ZCMD but it's seriously easier..

EDIT: Are you sure you got an enum for pAdmin? And the player info and all?
Worked fine! Thanks!
Reply
#7

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
Is it like this?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/acords", cmdtext, true) == 0) // it's not 10 lenght...
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 3)
            {
                SendClientMessage(playerid, COLOR_WHITE, "Cordinates Menu [/gotoco]");
                SendClientMessage(playerid, COLOR_WHITE, "Gotham City: 2203.3160 -5787.8170 13.3400 360.0000");
                return 1;
            }
        }
    }
    // more commands
    return 0;
}
And please show us the line the error comes from.
I can't use the ZCMD one..so I tried this.
I got one error: C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107199) : error 021: symbol already defined: "OnPlayerCommandText"
So no go.
Reply
#8

Quote:
Originally Posted by JJ_PR
Посмотреть сообщение
I can't use the ZCMD one..so I tried this.
I got one error: C:\Users\Jon\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(107199) : error 021: symbol already defined: "OnPlayerCommandText"
So no go.
He means is the OnPlayerCommandText like that?
Reply
#9

You pasted what I gave you! And now you've 2 callbacks of OnPlayerCommandText..
Does it look like the example I gave?
Reply
#10

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
You pasted what I gave you! And now you've 2 callbacks of OnPlayerCommandText..
Does it look like the example I gave?
It does look like it.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)