SA-MP Forums Archive
mAdmin help - 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: mAdmin help (/showthread.php?tid=274733)



mAdmin help - KappaCro - 07.08.2011

Hello all,
I am using mAdmin, but when i want to compile it, I always get this error:

Код:
C:\Users\Korisnik\Desktop\test\filterscripts\mAdmin.pwn(531) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
This is the PAWN code:
pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
    new RecieverName[24], pName[24], str[256];
    GetPlayerName(recieverid, RecieverName, sizeof(RecieverName));
    GetPlayerName(playerid, pName, sizeof(pName));
    format(str, sizeof(str), "* PM from %s (ID: %d) to %s (ID: %d): %s", pName, playerid, RecieverName, recieverid, text);
    SendModMsg(COLOR_LIGHTBLUE, str);
    return 1;
}
Any help will be highly appericiated

Kappa


Re: mAdmin help - Scenario - 07.08.2011

You need to go to the "mAdmin" release thread and get help there or try searching to see if someone has some up with a solution to the same, or similar problem.

You need to forward the function by the way...


Re: mAdmin help - Kush - 07.08.2011

Try
PHP код:
forward OnPlayerPrivmsg(playeridrecieveridtext[]); 
Before the function.


Re: mAdmin help - KappaCro - 07.08.2011

when i replace public with forward, i get alot of warnings


Re: mAdmin help - Kush - 07.08.2011

You don't replace 'public' with 'forward'. Your declaring what the function is and it's set parameters.

Do this:

PHP код:
forward OnPlayerPrivmsg(playeridrecieveridtext[]);  
public 
OnPlayerPrivmsg(playeridrecieveridtext[])
{
    new 
RecieverName[24], pName[24], str[256];
    
GetPlayerName(recieveridRecieverNamesizeof(RecieverName));
    
GetPlayerName(playeridpNamesizeof(pName));
    
format(strsizeof(str), "* PM from %s (ID: %d) to %s (ID: %d): %s"pNameplayeridRecieverNamerecieveridtext);
    
SendModMsg(COLOR_LIGHTBLUEstr);
    return 
1;




Re: mAdmin help - KappaCro - 07.08.2011

Fixed! Thanks man


Re: mAdmin help - Grim_ - 07.08.2011

The problem is that function will never be called (unless called somewhere else within the script), as that callback was removed in 0.3c version of SA:MP. Look in the filterscript section for working scripts to integrate PM systems.


Re: mAdmin help - KappaCro - 07.08.2011

I got new errors

pawn Код:
C:\Users\Korisnik\Desktop\test\filterscripts\mAdmin.pwn(2025) : error 021: symbol already defined: "strtok"
C:\Users\Korisnik\Desktop\test\filterscripts\mAdmin.pwn(2040) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
the code:
pawn Код:
strtok(const string[], &index)
{
        new length = strlen(string);
        while ((index < length) && (string[index] <= ' '))
        {
                index++;
        }

        new offset = index;
        new result[20];
        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
        {
                result[index - offset] = string[index];
                index++;
        }
        result[index - offset] = EOS;
        return result;
}
help pls


Re: mAdmin help - Basicz - 07.08.2011

1st warning = function strtok is already defined, delete your function.

To fix the 2nd warning
pawn Код:
new tmp[ 128 ]; // 128, array size does not match.
tmp = strtok( ... ); // ... = your arguments.
Instead of that, use
pawn Код:
new tmp[ 256 ]; // strtok needs 256.
tmp = strtok( ... ); // ... = your arguments.
better use sscanf.


Re: mAdmin help - KappaCro - 07.08.2011

Can you edit/upgrade my code because I don't understand you :/