Alright I have that OnPlayerText, I also have this but this is on OnPlayerCommandText. Its a team message thing. (/t )
Код:
new idx,cmd[128];
cmd = strtok(cmdtext,idx);
if(strcmp("/t",cmd,true) == 0 || strcmp("/team",cmd,true) == 0)
{
new pName[MAX_PLAYER_NAME],formatted[156];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid,-1,"Usage: /t(eam) text");
GetPlayerName(playerid,pName,sizeof(pName));
format(formatted,sizeof(formatted),"[Team]: %s(%d): %s",pName,playerid,result);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
{
SendClientMessage(i,-1,formatted);
}
}
return 1;
}
return 0;
I found other parts in my server which contains a name change but I thought its necessary to show. Next, I have a command to teleport to Verdant Meadows. (/ay)
Код:
if(!strcmp(cmdtext,"/ay",true))
{
SetPlayerPos(playerid,389.5595,2536.3604,16.5391);
GameTextForPlayer(playerid, "~g~Welcome to the Air Yard!", 2500, 0);
SendClientMessage(playerid, 0x33CCFFAA, "You successfully teleported to the Air Yard!");
new Name[MAX_PLAYER_NAME],
string[128];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "%s has teleported to the Air Yard over at Verdant Meadows!", Name);
SendClientMessageToAll(0x33CCFFAA, string);
return 1;
}
And last one is top kills one.... when a player has more than 6 kills, it announces....
Код:
if(TopKills == 6)
{
SendClientMessage(killerid,0x00ff00ff,"Wow you're a killer!");
GameTextForPlayer(playerid, "Super Killer!", 3000, 1);
GivePlayerMoney(killerid,10000);
SetPlayerScore(killerid, GetPlayerScore(killerid)+50);
new Name[MAX_PLAYER_NAME], // Name
string[128];
GetPlayerName(killerid, Name, sizeof(Name));
format(string, sizeof(string), "The killer named %s has just made his way to the top!", Name);
SendClientMessageToAll(0x33CCFFAA, string);
TopKills = 0;
}
return 1;
That's all the chat id's I have in my server.