30.08.2011, 11:11
how can I do in my server when someone write something to appears over the player
public OnPlayerText(playerid, text[])
{
new string[256];
new tmp[256];
SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 10000);
if(PlayerInfo[playerid][pMuted] != 0)
{
SendClientMessage(playerid, COLOR_ADMINCMD, " You are muted, you cannot speak.");
return 0;
}
if(CalculateStarted == 1)
{
switch (CalculateEvent)
{
case 1:
{
new idx;
tmp = strtok(text, idx);
if ((strcmp("49", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("49")))
{
CalculateStarted = 0;
CalculateEvent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
KillTimer(reactiontimer[i]);
}
PlayerInfo[playerid][pCWons] ++;
GivePlayerCash(playerid, 20000);
format(string, sizeof(string), "* %s has the fastest reaction of %.1f seconds. %s has won %d times before.", PlayerName(playerid), PlayerInfo[playerid][pCalcSec], PlayerName(playerid), PlayerInfo[playerid][pCWons]);
SendClientMessageToAll(COLOR_YELLOW, string);
PlayerInfo[playerid][pCalcSec] = 0.0;
}
}
case 2:
{
new idx;
tmp = strtok(text, idx);
if ((strcmp("5.44", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("5.44")))
{
CalculateStarted = 0;
CalculateEvent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
KillTimer(reactiontimer[i]);
}
PlayerInfo[playerid][pCWons] ++;
GivePlayerCash(playerid, 20000);
format(string, sizeof(string), "* %s has the fastest reaction of %.1f seconds. %s has won %d times before.", PlayerName(playerid), PlayerInfo[playerid][pCalcSec], PlayerName(playerid), PlayerInfo[playerid][pCWons]);
SendClientMessageToAll(COLOR_YELLOW, string);
PlayerInfo[playerid][pCalcSec] = 0.0;
}
}
case 3:
{
new idx;
tmp = strtok(text, idx);
if ((strcmp("10", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("10")))
{
CalculateStarted = 0;
CalculateEvent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
KillTimer(reactiontimer[i]);
}
PlayerInfo[playerid][pCWons] ++;
GivePlayerCash(playerid, 20000);
format(string, sizeof(string), "* %s has the fastest reaction of %.1f seconds. %s has won %d times before.", PlayerName(playerid), PlayerInfo[playerid][pCalcSec], PlayerName(playerid), PlayerInfo[playerid][pCWons]);
SendClientMessageToAll(COLOR_YELLOW, string);
PlayerInfo[playerid][pCalcSec] = 0.0;
}
}
case 4:
{
new idx;
tmp = strtok(text, idx);
if ((strcmp("obama", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("blood")))
{
CalculateStarted = 0;
CalculateEvent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
KillTimer(reactiontimer[i]);
}
PlayerInfo[playerid][pCWons] ++;
GivePlayerCash(playerid, 20000);
format(string, sizeof(string), "* %s has the fastest reaction of %.1f seconds. %s has won %d times before.", PlayerName(playerid), PlayerInfo[playerid][pCalcSec], PlayerName(playerid), PlayerInfo[playerid][pCWons]);
SendClientMessageToAll(COLOR_YELLOW, string);
PlayerInfo[playerid][pCalcSec] = 0.0;
}
}
case 5:
{
new idx;
tmp = strtok(text, idx);
if ((strcmp("blood", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("obama")))
{
CalculateStarted = 0;
CalculateEvent = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
KillTimer(reactiontimer[i]);
}
PlayerInfo[playerid][pCWons] ++;
GivePlayerCash(playerid, 20000);
format(string, sizeof(string), "* %s has the fastest reaction of %.1f seconds. %s has won %d times before.", PlayerName(playerid), PlayerInfo[playerid][pCalcSec], PlayerName(playerid), PlayerInfo[playerid][pCWons]);
SendClientMessageToAll(COLOR_YELLOW, string);
PlayerInfo[playerid][pCalcSec] = 0.0;
}
}
}
}
if(realchat)
{
format(string, sizeof(string), "(%d): %s", playerid, text[0]);
SendPlayerMessageToAll(playerid, string);
return 0;
}
return 1;
}
https://sampwiki.blast.hk/wiki/SetPlayerChatBubble
... You can't see it above your OWN head, others will see it though. |