[Help] Send Message To SWAT
#1

Код:
forward MessaggioSwat();
Код:
if(strcmp(cmdtext, "/911", true) == 0)
{
	new callingplayer[MAX_PLAYER_NAME];
	GetPlayerName(playerid, callingplayer, sizeof(callingplayer));
	format(string, sizeof(string), "%s need help.", callingplayer);
	SendClientMessageToAll(0xFFFF00AA, string);
	MessaggioSwat();


return 1;
}
Код:
public MessaggioSwat()
{
new name[MAX_PLAYER_NAME];

	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		GetPlayerName(playerid, name, sizeof(name));
		if(strcmp(name, "[sw]", true))
		{
					GameTextForPlayer(playerid,"%s Need Help!", 3000, 3, callingplayer);

			}
		}
	}
	return 1;
}
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(2275) : error 017: undefined symbol "playerid"
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(227 : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

How can i fix it?
Reply
#2

Код:
#define playerid
Reply
#3

Line 30: forward SendPlayerFormattedText(playerid, const str[], define);


C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(30) : error 010: invalid function or declaration
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(30) : error 001: expected token: ")", but found "const"
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(30) : error 001: expected token: ";", but found "const"
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(30) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Quote:

C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(2275) : error 017: undefined symbol "playerid"
C:\Users\MavericK\Documents\File ricevuti\peppe\gamemodes\lvdm.pwn(227 : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

How can i fix it?

i dont really know how to fix this but the errors are in your messaggioswat function meybe try MessaggioSwat(playerid) in your public?
Reply
#5

pawn Код:
forward MessaggioSwat(playerid);
pawn Код:
if(strcmp(cmdtext, "/911", true) == 0)
{
    new callingplayer[MAX_PLAYER_NAME];
    GetPlayerName(playerid, callingplayer, sizeof(callingplayer));
    format(string, sizeof(string), "%s need help.", callingplayer);
    SendClientMessageToAll(0xFFFF00AA, string);
    MessaggioSwat(playerid);

    return 1;
}
pawn Код:
public MessaggioSwat(playerid)
{
    new callingplayer[MAX_PLAYER_NAME];
    GetPlayerName(playerid, callingplayer, sizeof(callingplayer));

    new string[128];
    format(string, sizeof(string), "%s Need Help!", callingplayer);

    new name[MAX_PLAYER_NAME];

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, name, sizeof(name));
            if(strcmp(name, "[sw]", true, 4) == 0)
            {
                GameTextForPlayer(i, string, 3000, 3);
            }
        }
    }
    return 1;
}
Reply
#6

Ty, Testing..
Reply
#7

It works, but if [sw] isn't a tag and it is elsewhere in the name? like [RCS]asdada[sw]
Reply
#8

pawn Код:
if(strfind(name, "[sw]", true) != -1)
Reply
#9

Ty
Reply
#10

Problem Found!

pawn Код:
public MessaggioSwat()
{
new name[MAX_PLAYER_NAME];

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
        GetPlayerName(playerid, name, sizeof(name));
        if(strcmp(name, "[sw]", true))
        {
                    GameTextForPlayer(playerid,"%s Need Help!", 3000, 3, callingplayer);

            }
        }
    }
    return 1;
}
Look at this script:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
The variable for player is i and what i found is:

pawn Код:
GetPlayerName(playerid, name, sizeof(name));
        if(strcmp(name, "[sw]", true))
        {
                    GameTextForPlayer(playerid,"%s Need Help!", 3000, 3, callingplayer);

            }
        }
You should change the playerid into i. So it will be like this:

pawn Код:
GetPlayerName(i, name, sizeof(name));
        if(strcmp(name, "[sw]", true))
        {
                    GameTextForPlayer(i,"%s Need Help!", 3000, 3, callingplayer);

            }
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)