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



DM help - tanush - 09.03.2011

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


Re: DM help - Marricio - 09.03.2011

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.


Re: DM help - admantis - 09.03.2011

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.


Re: DM help - Marricio - 09.03.2011

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


Re: DM help - tanush - 10.03.2011

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



Re: DM help - Marricio - 10.03.2011

Show the line 38


Re: DM help - tanush - 10.03.2011

if(text[0] == @)


Re: DM help - pawn_ - 10.03.2011

Try

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



Re: DM help - tanush - 10.03.2011

thnx