SA-MP Forums Archive
Code crashing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Code crashing (/showthread.php?tid=598969)



Code crashing - Squirrel - 19.01.2016

So its quite simple this code is making me crash for some reason

PHP код:
#define MAX_TOYS 15000
CreateToyHere(Float:sX,Float:sY,Float:sZ,Float:sA) {
    for(new 
cID 0cID MAX_TOYScID++) {
        if(
ToyInfo[cID][ConeX] == 0.0 && ToyInfo[cID][ConeX] == 0.0 && ToyInfo[cID][ConeX] == 0.0) {
            
ToyInfo[cID][ConeX] = sX;
            
ToyInfo[cID][ConeY] = sY;
            
ToyInfo[cID][ConeZ] = sZ;
            
ToyInfo[cID][ConeAngle] = sA;
            
ToyInfo[cID][ConeObject] = CreateDynamicObject(973sXsYsZ0,0, -sA);
        }
    }
    return 
true;




Re: Code crashing - Prokill911 - 19.01.2016

Sorry, I'm confused what is it you're asking?

Why is the code crashing?


Re: Code crashing - Jefff - 19.01.2016

You need use 'break' because its creating 15000 objects in your server


Re: Code crashing - Prokill911 - 19.01.2016

Quote:
Originally Posted by Jefff
Посмотреть сообщение
You need use 'break' because its creating 15000 objects in your server
Pretty much what he said.
Your foreach statement creates 15,000 Objects
You never tell it when to stop,
You just say while X < 15,000 - Repeat the action


Re: Code crashing - Squirrel - 19.01.2016

Mi mom gave me a birth and she dropped me... Thanks a lot guys! Yeah was correct, was creating 15k objects... (stupid me ...)
+rep


Re: Code crashing - Prokill911 - 19.01.2016

Lol Np