SA-MP Forums Archive
Sending string to function? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Sending string to function? (/showthread.php?tid=201574)



Sending string to function? - oliverrud - 21.12.2010

I'm trying to send a string to a function I got
pawn Code:
SendAdminWarning(hackstring);
pawn Code:
function SendAdminWarning(msg)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(AccountData[i][Admin] > 0)
        {
            SendClientMessage(i,COLOR_RED,msg);
        }
    }
}
However I am receiving errors on both of them the same just different arguments
1 and 3
Example:
pawn Code:
error 035: argument type mismatch (argument 3)
I suppose I'm doing something wrong here?


Re: Sending string to function? - Macluawn - 21.12.2010

yea you are.
Code:
function SendAdminWarning(msg[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(AccountData[i][Admin] > 0)
        {
            SendClientMessage(i,COLOR_RED,msg);
        }
    }
}



Re: Sending string to function? - oliverrud - 21.12.2010

Hehe thank you, funny enough right after posting this post it crossed my mind that, that was the issue