MANY THINGS disappeared after adding stuff - need help badly!
#1

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:
  • 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
I can't post what I added, it would be way too long! I'mma just post the things which became shitty!

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"9999999990);
        }
    } 
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:

PHP код:
    new Text:FPS[MAX_PLAYERS];
    new 
DLlast[MAX_PLAYERS] = 0;
    new 
FPS2[MAX_PLAYERS] = 0;
    new 
fpsstring[24]; 
Under "OnGameModeInit":

PHP код:
 public OnGameModeInit() {
    
    for(new 
0MAX_PLAYERSi++)
        {
            
FPS[i] = TextDrawCreate(8.000000428.000000"FPS: 30");
            
TextDrawBackgroundColor(FPS[i], 255);
             
TextDrawFont(FPS[i], 3);
              
TextDrawLetterSize(FPS[i], 0.4800002.000000);
             
TextDrawColor(FPS[i], -65281);
               
TextDrawSetOutline(FPS[i], 1);
             
TextDrawSetProportional(FPS[i], 1);
        }
SetTimer("FPSUP",1203,true); 
Under "OnPlayerDisconnect":
PHP код:
TextDrawDestroy(FPS[playerid]); 
Under "OnPlayerSpawn":

PHP код:
TextDrawShowForPlayer(playerid,FPS[playerid]); 
"OnPlayerUpdate":

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 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
format(fpsstring,sizeof(fpsstring),"FPS: %d",FPS2[i]-1);
                        
TextDrawSetString(FPS[i],fpsstring);
                }
                continue;
        }

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:

PHP код:
public OnPlayerText(playeridtext[])
{
    if(
PlayerInfo[playerid][pAdmin] == && !IsPlayerAdmin(playerid))
    {
        
#if AntiSpam == true
        
if(PlayerInfo[playerid][SpamCount] == 0PlayerInfo[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(playeridname24);
            
format(str128"[ADMIN CHAT] %s(%d): %s"name,playeridtext[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 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i) && gTeam[playerid] == gTeam[i])
                    
SendClientMessage(i,COLOR_YELLOW,string);
            }
            return 
0;
            }
    new 
textmsg[128];
    
format(textmsgsizeof(textmsg), "(%d): %s"playeridtext);
    
SendPlayerMessageToAll(playeridtextmsg);
    return 
0;

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!
Reply
#2

If all of that worked before you added something then that is obviosly not the bugged code, it will have to be something in the new code causing this.
Reply
#3

I know, but what shall I do now? I can't just delete everything I had man...It's soooo much, and it costed me really much time! What could I do?
Reply
#4

Does what you added work correctly? if so I would just delete the midnight script, and then totally rescript the whole wheather system, if what you added does not work just remove it, also I suggest you make a backup of your .pwn file before you do any major changes
Reply
#5

Erm, I don't know if it works, I'd need a tester for this! I've got a backup from after adding this stuff...So, would you come online?
Reply
#6

Sure send me your ip in a private message


This forum requires that you wait 120 seconds between posts. Please try again in 24 seconds.
Reply
#7

Your midnight timer...Probably doesn't work.

pawn Код:
new NightTimer; //outside of everything

//inside of the function
NightTimer = SetTimer("SetNight", 5*60*1000, true); //set it to 5 minutes, and make it repeating

//Then kill it when you want to stop it
KillTimer(NightTimer);
I would do something like this instead, then kill it if you don't want it


Don't know why it's bugging though
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)