SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Problem declaring/calling a function (https://forum.sa-mp.com/showthread.php?t=562525)

Alvin007 09/02/2015 05:06 PM

Problem declaring/calling a function
 
Hello all, i wanted to make a function which sends a message to admins aka
PlayerInfo[playerid][pAdmin]>0
but error messages kept appearing.
ERROR MSG:
Quote:

C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 364) : error 029: invalid expression, assumed zero
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 364) : warning 215: expression has no effect
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 364) : error 001: expected token: ";", but found ")"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 364) : error 029: invalid expression, assumed zero
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 364) : fatal error 107: too many error messages on one line
This is a function, above OnGameModeInIt and under main()
PHP Code:

forward SendAdminsMessage(playerid,string);
public 
SendAdminsMessage(playerid,string)
{
    foreach (new 
iPlayer)
    {
        if(
PlayerInfo[i][pAdmin])>0)
        
SendClientMessage(i,RED,chaine);
    }
    return 
1;


I tried the same thing with changing it from public to stock.
And Thanks.

Schneider 09/02/2015 05:18 PM

Re: Problem declaring/calling a function
 
You got a bracket ')' too many.
pawn Code:
if(PlayerInfo[i][pAdmin]>0)

Alvin007 09/02/2015 05:32 PM

Re : Problem declaring/calling a function
 
Quote:

C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 208) : error 035: argument type mismatch (argument 3)
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 548) : error 035: argument type mismatch (argument 1)
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 550) : error 017: undefined symbol "ServerInfo"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 550) : warning 215: expression has no effect
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 550) : error 001: expected token: ";", but found "]"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 550) : error 029: invalid expression, assumed zero
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 550) : fatal error 107: too many error messages on one line
PHP Code:

forward SendAdminsMessage(playerid,string);
public 
SendAdminsMessage(playerid,string)
{
    foreach (new 
iPlayer)
    {
        if(
PlayerInfo[i][pAdmin]>0)
        
SendClientMessage(i,RED,string);
    }
    return 
1;



Schneider 09/02/2015 05:33 PM

Re: Problem declaring/calling a function
 
pawn Code:
forward SendAdminsMessage(playerid,string[]);
public SendAdminsMessage(playerid,string[])
{
    foreach (new i: Player)
    {
        if(PlayerInfo[i][pAdmin]>0)
        SendClientMessage(i,RED,string);
    }
    return 1;
}

Alvin007 09/02/2015 06:50 PM

Re : Problem declaring/calling a function
 
Thank you very much Schneider.


All times are GMT. The time now is 10:14 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.