Why do I get these errors?
#1

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '*' && PlayerInfo[playerid][ALevel] >= 1)
    {
        new name;
        new string;
        GetPlayerName(playerid,name,24); //190
        format(string,sizeof(string),"Admin Chat: %s (id:%d): %s",name,playerid,text[1]); //191
        SendMessageToAdmins(string);
        return 0;
    }
    return 1;
}

stock SendMessageToAdmins(text[])
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][ALevel] >= 1 && IsPlayerConnected(i))
        {
            SendClientMessage(i,blue,text);
            return 1;
        }
    }
}
Why am I getting these errors?

Код:
test.pwn(190) : error 035: argument type mismatch (argument 2)
test.pwn(191) : error 035: argument type mismatch (argument 1)
test.pwn(191) : error 035: argument type mismatch (argument 1)
test.pwn(192) : error 035: argument type mismatch (argument 1)
test.pwn(189) : warning 203: symbol is never used: "string"
test.pwn(208) : warning 209: function "SendMessageToAdmins" should return a value
Reply
#2

Its because you're using them the wrong way, tell me which lines are 190, 191, and 192

I'll tell you the proper way to use em.
Reply
#3

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '*' && PlayerInfo[playerid][ALevel] >= 1)
    {
        new name[MAX_PLAYER_NAME];
        new string;
        GetPlayerName(playerid,name,24); //190
        format(string,sizeof(string),"Admin Chat: %s (id:%d): %s",name,playerid,text[1]); //191
        SendMessageToAdmins(string);
        return 0;
    }
    return 1;
}

stock SendMessageToAdmins(text[])
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][ALevel] >= 1 && IsPlayerConnected(i))
        {
            SendClientMessage(i,blue,text);
            return 1;
        }
    }
}
Reply
#4

Quote:
Originally Posted by FireCat
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '*' && PlayerInfo[playerid][ALevel] >= 1)
    {
        new name[MAX_PLAYER_NAME];
        new string;
        GetPlayerName(playerid,name,24); //190
        format(string,sizeof(string),"Admin Chat: %s (id:%d): %s",name,playerid,text[1]); //191
        SendMessageToAdmins(string);
        return 0;
    }
    return 1;
}

stock SendMessageToAdmins(text[])
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][ALevel] >= 1 && IsPlayerConnected(i))
        {
            SendClientMessage(i,blue,text);
            return 1;
        }
    }
}
Hmm... Still the same :/

I get the errors on the format string line now.
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '*' && PlayerInfo[playerid][ALevel] >= 1)
    {
        new name[MAX_PLAYER_NAME];
        new string[64];
        GetPlayerName(playerid,name,sizeof(name)); //190
        format(string,sizeof(string),"Admin Chat: %s (id:%d): %s",name,playerid,text[1]); //191
        SendMessageToAdmins(string);
        return 0;
    }
    return 1;
}

stock SendMessageToAdmins(text[])
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][ALevel] >= 1 && IsPlayerConnected(i))
        {
            SendClientMessage(i,blue,text);
            return 1;
        }
    }
}
Reply
#6

@FireCat.

PHP код:
GetPlayerName(playeridnamesizeof(name)); 
You replaces sizeof with with a number.

PHP код:
format(stringsizeof(string), "Admin Chat: %s (id:%d): %s" name ,playerid ,text[1]) 
You're using 6 parameters, when it should be 5.
Reply
#7

It still says "SendMessageToAdmins" should return a value.

EDIT: Fixed!
Reply
#8

Removed: Fixed ^^
Reply
#9

Quote:
Originally Posted by Tigerbeast11
Посмотреть сообщение
It still says "SendMessageToAdmins" should return a value.

EDIT: Fixed!
PHP код:
forward SendMessageToAdmins(string[]);
public 
SendMessageToAdmins(string[]) {
foreach(
Playeri) {
if(
PlayerInfo[i][ALevel] >= || IsPlayerAdmin(i)) {
    
SendClientMessage(ibluestring);
        }
    }

or

PHP код:
stock SendMessageToAdmins(text[])
{
    for(new 
iMAX_PLAYERSi++)
    {
        if(
PlayerInfo[i][ALevel] >= && IsPlayerConnected(i))
        {
            
SendClientMessage(i,blue,text);
        }
    }
    return 
1//return the value of the compound function before it is enclosed.

Reply
#10

An error is that "string" has only 1 cell (It's not an array), it MUST be an array for containing a string.
Reply
#11

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
An error is that "string" has only 1 cell (It's not an array), it MUST be an array for containing a string.
I believe he fixed it.
Reply
#12

Quote:
Originally Posted by G4M3Ov3r
Посмотреть сообщение
I believe he fixed it.
I didn't read FireCat's code
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)