Flag system doesn't work anymore
#1

Hello, I have edited my flag system but getting 2 warnings, can anyone tell me what is wrong here ?


Код:
gamemodes\Roleplay.pwn(60251) : warning 235: public function lacks forward declaration (symbol "AddFlag")
gamemodes\Roleplay.pwn(60261) : warning 235: public function lacks forward declaration (symbol "RemoveFlag")
The code:

PHP код:
public AddFlag(playerid,adminid,reason[])
{
    new 
month,day,year;
    
getdate(year,month,day);
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
format(PlayerInfo[playerid][pFlag],128,"%s - %s (%d/%d/%d)",reason,GetPlayerNameEx(adminid),month,day,year);
}
// RemoveFlag Function (playerid)
public RemoveFlag(playerid)
{
    if(
strlen(PlayerInfo[playerid][pFlag]) > 0)
    {
        
format(PlayerInfo[playerid][pFlag],128,"");
        return 
1;
    }
    else
    {
        return 
0;
    }

Reply
#2

If you're going to use those functions from other scripts (CallRemoteFunction), add "forward X;"
(For example X is "RemoveFlag(playerid)"

If you aren't going to do that, then there's no need for them to be callbacks, so just remove "public "


[This isn't necessary but it's a much better version of RemoveFlag]
Код:
public RemoveFlag(playerid)
{
	if (PlayerInfo[playerid][pFlag][0] != 0 && PlayerInfo[playerid][pFlag][0] != '\1')
	{
		PlayerInfo[playerid][pFlag][0] = 0;
		return 1;
	}
        return 0;
}
Reply
#3

forward AddFlag(playerid,adminid,reason[]);
forward RemoveFlag(playerid);

Just remove them being as it's a function.
Reply
#4

Quote:
Originally Posted by Stinged
Посмотреть сообщение
If you're going to use those functions from other scripts (CallRemoteFunction), add "forward X;"
(For example X is "RemoveFlag(playerid)"

If you aren't going to do that, then there's no need for them to be callbacks, so just remove "public "
I have added this option so I'm able to add more then 1 flag the problem is if I flag someone for test123 and then I flag the same person for reason 123test it removes the test123 flag and replace it with the 123test

do you have any other idea how I can make it possible that people can have more flags on them ?


This is the old add flag

PHP код:
stock AddFlag(playerid,adminid,reason[])
{
    new 
month,day,year;
    
getdate(year,month,day);
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
     
format(PlayerInfo[playerid][pFlag],128,"%s - %s (%d/%d/%d)",reason,GetPlayerNameEx(adminid), daymonthyear);

Reply
#5

when you're formating PlayerInfo[playerid][pFlag] put PlayerInfo[playerid][pFlag] in it too before putting the other stuff like the below code:
PHP код:
AddFlag(playerid,adminid,reason[]) 

    new 
month,day,year
    
getdate(year,month,day); 
    new 
playername[MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridplayernamesizeof(playername)); 
     
format(PlayerInfo[playerid][pFlag],128,"%s%s - %s (%d/%d/%d) ",PlayerInfo[playerid][pFlag], reason,GetPlayerNameEx(adminid), daymonthyear); 

about the "stock": https://sampforum.blast.hk/showthread.php?tid=570635
Reply
#6

I do not understand sorry, but can you explane me how I can add more then 1 flag on a person ?
Reply
#7

?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)