SA-MP Forums Archive
Problem - 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)
+--- Thread: Problem (/showthread.php?tid=436235)



Problem - EdvinasStudio - 10.05.2013

I got this error:

D:\Edvinas\Server\LG\gamemodes\RPG.pwn(310) : error 010: invalid function or declaration

On this line:

Код:
stock SiustiZinuteAdministratoriams(SPALVA,text[])

All code: stock SiustiZinuteAdministratoriams(SPALVA,text[])
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(PareigosDB[i][Administratorius] > 1)
			{
				SendClientMessage(i,0xFFFFFFAA,text);
			}
		}
	}
}
Код:
	if(listitem == 4)
{
	new A1ZINUTE[512];
    new Vardas[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Vardas,MAX_PLAYER_NAME);
    format(A1ZINUTE,sizeof A1ZINUTE,"{FFFFFF}Administratorius {FF8000}%s {99FF33}I {FFFFFF}lygio pasieme ginklus.",Vardas);
	SiustiZinuteAdministratoriams(SPALVA,A1ZINUTE);
}
	return 1;
}
Код:
#define SPALVA 0xFFFFFFAA



Re: Problem - Antonio144 - 10.05.2013

Change this
pawn Код:
stock SiustiZinuteAdministratoriams(SPALVA,text[]) //SPALVA = that parametar can't be named the same as #define
to
pawn Код:
stock SiustiZinuteAdministratoriams(Color,text[]) // so change it to something else, i used "Color"
The complete code:
pawn Код:
#define SPALVA 0xFFFFFFAA

stock SiustiZinuteAdministratoriams(Color,text[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PareigosDB[i][Administratorius] > 1)
            {
                SendClientMessage(i,Color,text);
            }
        }
    }
}

//-----------
if(listitem == 4)
{
    new A1ZINUTE[80]; // This string does not need to be this big, 80 should be enough.
    new Vardas[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Vardas,MAX_PLAYER_NAME);
    format(A1ZINUTE,sizeof A1ZINUTE,"{FFFFFF}Administratorius {FF8000}%s {99FF33}I {FFFFFF}lygio pasieme ginklus.",Vardas);
    SiustiZinuteAdministratoriams(SPALVA,A1ZINUTE);
}



Re: Problem - EdvinasStudio - 11.05.2013

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
Change this
pawn Код:
stock SiustiZinuteAdministratoriams(SPALVA,text[]) //SPALVA = that parametar can't be named the same as #define
to
pawn Код:
stock SiustiZinuteAdministratoriams(Color,text[]) // so change it to something else, i used "Color"
The complete code:
pawn Код:
#define SPALVA 0xFFFFFFAA

stock SiustiZinuteAdministratoriams(Color,text[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PareigosDB[i][Administratorius] > 1)
            {
                SendClientMessage(i,Color,text);
            }
        }
    }
}

//-----------
if(listitem == 4)
{
    new A1ZINUTE[80]; // This string does not need to be this big, 80 should be enough.
    new Vardas[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Vardas,MAX_PLAYER_NAME);
    format(A1ZINUTE,sizeof A1ZINUTE,"{FFFFFF}Administratorius {FF8000}%s {99FF33}I {FFFFFF}lygio pasieme ginklus.",Vardas);
    SiustiZinuteAdministratoriams(SPALVA,A1ZINUTE);
}
Thanks for helping