Respawning objects?
#4

I got this working, destroying and re-creating every minute. It worked perfectly fine on my home test server..

I uploaded it to my rented server and restarted it.

It seemed fine but then when one person joined, it would not let anyone else join, all it would say is Connected to Network, Loading Game...

If two actually managed to get in the server it would restart in a very short time.

Also when i checked the CPU usage it was around 0 - 4%

Then it jumped to 99 - 101%

here the code, its crappy i know, i couldn't really figure how to do it more efficient, so that it would run smooth and not drain the CPU.

pawn Код:
new ATMmachine[11];

stock ATMSpawner()
{
ATMmachine[0] = CreateStreamedObject(2942, 2003.497, -2352.371, 13.19, 0, 0, -90);
ATMmachine[1] = CreateStreamedObject(2942, 2003.683, -2280.22, 13.19, 0, 0, -90);
ATMmachine[2] = CreateStreamedObject(2942, -1974.457, 169.655, 27.287, 0, 0, -540);
ATMmachine[3] = CreateStreamedObject(2942, -2715.579, 210.804, 3.971, 0, 0, -630);
ATMmachine[4] = CreateStreamedObject(2942, -2453.688, 754.936, 34.815, 0, 0, -720);
ATMmachine[5] = CreateStreamedObject(2942, -1427.802, 2591.614, 55.479, 0, 0, -180);
ATMmachine[6] = CreateStreamedObject(2942, -180.7, 1036.35, 19.41, 0, 0, -90);
ATMmachine[7] = CreateStreamedObject(2942, -856.526, 1528.602, 22.23, 0, 0, -270);
ATMmachine[8] = CreateStreamedObject(2942, 147.777, -1865.438, 3.416, 0, 0, -270);
ATMmachine[9] = CreateStreamedObject(2942, 2334.29, 58.78, 26.127, 0, 0, -270);
ATMmachine[10] = CreateStreamedObject(2942,2000.658,1525.084,14.243,0.0,0.0,-180.000);
return 1;
}

stock ATMDestroyer()
{
    DestroyStreamedObject(ATMmachine[0]);
    DestroyStreamedObject(ATMmachine[1]);
    DestroyStreamedObject(ATMmachine[2]);
    DestroyStreamedObject(ATMmachine[3]);
    DestroyStreamedObject(ATMmachine[4]);
    DestroyStreamedObject(ATMmachine[5]);
    DestroyStreamedObject(ATMmachine[6]);
    DestroyStreamedObject(ATMmachine[7]);
    DestroyStreamedObject(ATMmachine[8]);
    DestroyStreamedObject(ATMmachine[9]);
    DestroyStreamedObject(ATMmachine[10]);
    return 1;
}
   

forward ATM_Update();
public ATM_Update()
{
    ATMDestroyer();
    ATMSpawner();
}
I've got a timer in OnGamemodeInit

pawn Код:
SetTimer("ATM_Update", 60000, 1);

I know this is a pretty crap code, so how could i get it working better?
Reply


Messages In This Thread
Respawning objects? - by Outbreak - 02.03.2009, 22:51
Re: Respawning objects? - by Nubotron - 02.03.2009, 23:28
Re: Respawning objects? - by Outbreak - 03.03.2009, 01:11
Re: Respawning objects? - by Outbreak - 04.03.2009, 16:26

Forum Jump:


Users browsing this thread: 1 Guest(s)