SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/02/2015, 05:06 PM   #1
Alvin007
Huge Clucker
 
Alvin007's Avatar
 
Join Date: Mar 2011
Location: Tunisia
Posts: 245
Reputation: 9
Default 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.
__________________
Alvin007 is offline   Reply With Quote
Old 09/02/2015, 05:18 PM   #2
Schneider
Gangsta
 
Schneider's Avatar
 
Join Date: Jun 2007
Location: Netherlands
Posts: 515
Reputation: 136
Default Re: Problem declaring/calling a function

You got a bracket ')' too many.
pawn Code:
if(PlayerInfo[i][pAdmin]>0)
Schneider is offline   Reply With Quote
Old 09/02/2015, 05:32 PM   #3
Alvin007
Huge Clucker
 
Alvin007's Avatar
 
Join Date: Mar 2011
Location: Tunisia
Posts: 245
Reputation: 9
Default 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;

__________________
Alvin007 is offline   Reply With Quote
Old 09/02/2015, 05:33 PM   #4
Schneider
Gangsta
 
Schneider's Avatar
 
Join Date: Jun 2007
Location: Netherlands
Posts: 515
Reputation: 136
Default 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;
}
Schneider is offline   Reply With Quote
Old 09/02/2015, 06:50 PM   #5
Alvin007
Huge Clucker
 
Alvin007's Avatar
 
Join Date: Mar 2011
Location: Tunisia
Posts: 245
Reputation: 9
Default Re : Problem declaring/calling a function

Thank you very much Schneider.
__________________
Alvin007 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Remote Function calling Lordzy Tutorials 5 05/07/2014 02:44 PM
Calling a remote function with optional parameters RajatPawar Scripting Help 0 21/10/2013 11:24 AM
[Help] Calling function via string BloodMaster Scripting Help 2 12/10/2011 06:00 PM


All times are GMT. The time now is 03:18 AM.


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