19.03.2012, 19:16
Guys, no time for talking around! I need your help, BADLY AND FAST!
I added an attackable turf-system to my server, and now the following shit won't work anymore:
1. My server had a function which kept the time always at midnight, it NEVER changed and stayed like this all time:
2. The second problem is, that the FPS-displayer doesn't work anymore! I just had it under "OnGameModeInit", it won't show anymore after the adding of my stuff:
Under "OnGameModeInit":
Under "OnPlayerDisconnect":
Under "OnPlayerSpawn":
"OnPlayerUpdate":
3. The last problem is the following:
When a player chats, his name should usually be in the color of the team he's into right now! BUT, it doesn't matter in which team I am, the message will be sent with the name in the color orange... Here is the callback, worked everything 'til I added shit today:
WHOEVER can solve only 1 of these problems, would really help me and receive a deserved reputation point! I'm getting crazy, I can't just delete everything what I added right now, it took me so much time!
I added an attackable turf-system to my server, and now the following shit won't work anymore:
- The timer for my server which should stay forever at night
- The FPS-displaying
- The local chat, a wrong colour won't let players chat
1. My server had a function which kept the time always at midnight, it NEVER changed and stayed like this all time:
PHP код:
new KeepNight = 0;
new ServerTime = 24;
PHP код:
forward SetNight();public SetNight()
{
SetWorldTime(ServerTime);
if(KeepNight)
{
SetTimer("SetNight", 999999999, 0);
}
}
PHP код:
new Text:FPS[MAX_PLAYERS];
new DLlast[MAX_PLAYERS] = 0;
new FPS2[MAX_PLAYERS] = 0;
new fpsstring[24];
PHP код:
public OnGameModeInit() {
for(new i = 0; i < MAX_PLAYERS; i++)
{
FPS[i] = TextDrawCreate(8.000000, 428.000000, "FPS: 30");
TextDrawBackgroundColor(FPS[i], 255);
TextDrawFont(FPS[i], 3);
TextDrawLetterSize(FPS[i], 0.480000, 2.000000);
TextDrawColor(FPS[i], -65281);
TextDrawSetOutline(FPS[i], 1);
TextDrawSetProportional(FPS[i], 1);
}
SetTimer("FPSUP",1203,true);
PHP код:
TextDrawDestroy(FPS[playerid]);
PHP код:
TextDrawShowForPlayer(playerid,FPS[playerid]);
PHP код:
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100)
{
SetPlayerDrunkLevel(playerid,2000);
}
else
{
if(DLlast[playerid] != drunk2)
{
new fps = DLlast[playerid] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[playerid] = fps;
DLlast[playerid] = drunk2;
}
}
PHP код:
forward FPSUP();
public FPSUP()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(fpsstring,sizeof(fpsstring),"FPS: %d",FPS2[i]-1);
TextDrawSetString(FPS[i],fpsstring);
}
continue;
}
}
When a player chats, his name should usually be in the color of the team he's into right now! BUT, it doesn't matter in which team I am, the message will be sent with the name in the color orange... Here is the callback, worked everything 'til I added shit today:
PHP код:
public OnPlayerText(playerid, text[])
{
if(PlayerInfo[playerid][pAdmin] == 0 && !IsPlayerAdmin(playerid))
{
#if AntiSpam == true
if(PlayerInfo[playerid][SpamCount] == 0) PlayerInfo[playerid][SpamTime] = TimeStamp();
PlayerInfo[playerid][SpamCount]++;
if(TimeStamp() - PlayerInfo[playerid][SpamTime] > SPAM_TIME)
{
PlayerInfo[playerid][SpamCount] = 0;
PlayerInfo[playerid][SpamTime] = TimeStamp();
}
else if(PlayerInfo[playerid][SpamCount] == MAX_SPAM_MSG)
{
new string[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
SpamKickLog(playerid);
format(string,sizeof(string),"Player %s (ID:%d) has been automatically kicked! (Reason: Spamming)", name,playerid);
SendClientMessageToAll(COLOR_RED,string);
Kick(playerid);
}
else if(PlayerInfo[playerid][SpamCount] == MAX_SPAM_MSG-1)
{
SendClientMessage(playerid,COLOR_RED,"ATTENTION: Next spam warning will result in a kick!");
return 0;
}
#endif
}
if(text[0] == '#')
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new str[128], name[24];
GetPlayerName(playerid, name, 24);
format(str, 128, "[ADMIN CHAT] %s(%d): %s", name,playerid, text[1]);
SendMessageToAdmins(COLOR_LIGHTBLUE,str);
return 0;
}
return 1;
}
new string[256];
new playername[MAX_PLAYER_NAME];
if(text[0] == '!' && text[1] != 0)
{
GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
format(string,128,"[Team-Chat] %s: %s", playername,text[1] );
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[playerid] == gTeam[i])
SendClientMessage(i,COLOR_YELLOW,string);
}
return 0;
}
new textmsg[128];
format(textmsg, sizeof(textmsg), "(%d): %s", playerid, text);
SendPlayerMessageToAll(playerid, textmsg);
return 0;
}