FS Crashes the server
#1

Im trying to make some explosions on a timer and it crashes the server after about 5 secs so im thinking somethings wrong with the timer or something else i dont know?

pawn Code:
#include <a_samp>

forward AttackTimer();
forward DefenceTimer();

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/AttackStrike", cmdtext, true, 10) == 0)
    {
        SetTimer("AttackTimer", 5000, 1);
        SendClientMessageToAll(0xFF0000, "%s Has Sent an Airstrike, Take Cover!");
        GivePlayerMoney(playerid, -1000);
        return 1;
    }
   
    if (strcmp("/DefenceStrike", cmdtext, true, 10) == 0)
    {
        SetTimer("OneSecTimer", 5000, 1);
        SendClientMessageToAll(0xFF0000, "%s Has Sent an Airstrike, Take Cover!");
        GivePlayerMoney(playerid, -1000);
        return 1;
    }
   
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFF0000, "/DefenceStrike or /AttackStrike. Make sure you choose the right One!");
        return 1;
    }
    return 0;
}

public AttackTimer()
{
    CreateExplosion(1316,3371,6,0,5);
    CreateExplosion(1320,3350,2,0,3);
    CreateExplosion(1300,3333,1,4,4);
    CreateExplosion(1292,3353,3,0,4);
}

public DefenceTimer()
{
    CreateExplosion(1217,3154,2,0,5);
    CreateExplosion(1230,3156,2,0,3);
    CreateExplosion(1243,3152,2,4,4);
    CreateExplosion(1232,3174,2,0,4);
}
Reply
#2

Found!

SendClientMessageToAll(0xFF0000, "%s Has Sent an Airstrike, Take Cover!");

You didn't defined %s anywhere, use format.
Reply
#3

so now i have this and it should work?

pawn Code:
if (strcmp("/AttackStrike", cmdtext, true, 10) == 0)
    {
      SetTimer("AttackTimer", 5000, 1);
        new name[MAX_PLAYER_NAME+1];
        new String[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(String, sizeof(String), "%s Has Sent an Airstrike, Take Cover!", name);
        SendClientMessageToAll(0xDC143CAA, String);
        GivePlayerMoney(playerid, -1000);
        return 1;
    }
   
    if (strcmp("/DefenceStrike", cmdtext, true, 10) == 0)
    {
      SetTimer("OneSecTimer", 5000, 1);
      new name[MAX_PLAYER_NAME+1];
        new String[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(String, sizeof(String), "%s Has Sent an Airstrike, Take Cover!", name);
        SendClientMessageToAll(0xDC143CAA, String);
        GivePlayerMoney(playerid, -1000);
        return 1;
    }
Reply
#4

Works thanks
Reply
#5

This could be a possible fix to it alll

pawn Code:
#include <a_samp>

#define FILTERSCRIPT

forward AttackTimer();
forward DefenceTimer();

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    new name[MAX_PLAYER_NAME];
    new string[128];

    if (strcmp("/AttackStrike", cmdtext, true, 10) == 0)
    {
    if(GetPlayerMoney(playerid) > 1000) {
    SetTimer("AttackTimer", 5000, 1);
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"%s Has Sent an Airstrike, Take Cover!",name);
    SendClientMessageToAll(0xFF0000,string);
    GivePlayerMoney(playerid, -1000);
    }
    else
    {
    SendClientMessage(playerid,0xFF0000,"Not enough money!");
    }
    return 1;
    }

    if (strcmp("/DefenceStrike", cmdtext, true, 10) == 0)
    {
    if(GetPlayerMoney(playerid) > 1000) {
    SetTimer("OneSecTimer", 5000, 1);
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"%s Has Sent an Airstrike, Take Cover!",name);
    SendClientMessageToAll(0xFF0000, string);
    GivePlayerMoney(playerid, -1000);
    }
    else
    {
    SendClientMessage(playerid,0xFF0000,"Not enough money!");
    }
    return 1;
    }

    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, 0xFF0000, "/DefenceStrike or /AttackStrike. Make sure you choose the right One!");
    return 1;
    }
   
    return 0;
}

public AttackTimer()
{
    CreateExplosion(1316,3371,6,0,5);
    CreateExplosion(1320,3350,2,0,3);
    CreateExplosion(1300,3333,1,4,4);
    CreateExplosion(1292,3353,3,0,4);
}

public DefenceTimer()
{
    CreateExplosion(1217,3154,2,0,5);
    CreateExplosion(1230,3156,2,0,3);
    CreateExplosion(1243,3152,2,4,4);
    CreateExplosion(1232,3174,2,0,4);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)