DM help
#1

How can i make a team chat with "@". im using gTeam!!! And how can i make if player shoots the target. the target wont lose health
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == @)
    {
        new string[128], name[MAX_PLAYER_NAME];
        format(string,128,"[TEAM] %s[%d]: %s",name,playerid,text[1]);
        SendTeamMessage(playerid,string);
        return 0;
    }
    return 1;
}
pawn Код:
stock SendTeamMessage(playerid,string[])
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(gTeam[playerid] == gTeam[i])
        {
            return SendClientMessage(i,-1,string);
        }
    }
}
Might not work, not tested.
Reply
#3

Quote:
Originally Posted by Marricio
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(strfind(text,"@",true)==0)
    {
        new string[128], name[MAX_PLAYER_NAME];
        format(string,128,"[TEAM] %s[%d]: %s",name,playerid,text[1]);
        SendTeamMessage(playerid,string);
        return 1;
    }
    return 0;
}
pawn Код:
stock SendTeamMessage(playerid,string[])
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(gTeam[playerid] == gTeam[i])
        {
            return SendClientMessage(i,-1,string);
        }
    }
}
Might not work, not tested.
This will send a message if the @ symbol si placed anywhere (middle, end..) for example you type

Hello g@uys
Hello guys@
H@ello guys

It will send a team message.

Plus it will say the normal chat message too.
Reply
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
This will send a message if the @ symbol si placed anywhere (middle, end..) for example you type

Hello g@uys
Hello guys@
H@ello guys

It will send a team message.

Plus it will say the normal chat message too.
Okay?... Edited+fixed a little bug
Reply
#5

pawn Код:
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(38) : error 029: invalid expression, assumed zero
Reply
#6

Show the line 38
Reply
#7

if(text[0] == @)
Reply
#8

Try

pawn Код:
if(text[0] == '@')
Reply
#9

thnx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)