Jump to content

Errors with seemingly normal code


Sacky

Recommended Posts

Well i'm trying to test my player limit patch out, so i hooked this function to the spacebar (in the keyboardproc):

 

 

const SCRIPT_COMMAND create_player    = { 0x0053, "ifffv" };	// Skin, x, y, z, PLAYER_CHARFILE *fd = fopen ( "testdump.txt", "w" );if ( fd ){for ( int i = 0; i < 100; i++ ){ fprintf ( fd, "Loading Player: %d\n", i ); DWORD Thingy; ScriptCommand ( &create_player, 0, 0.0, 0.0, 0.0, &Thingy );       }else MessageBox ( 0, "File Open Failed", "Test", 0 );fclose ( fd );

 

 

It crashes after this:

 

 

Loading Player: 0

 

Is there anything i'm doing wrong here (this occurs with and without the patch)?

Edited by Sacky
Link to comment
Share on other sites

Which scripting hook are you using? I have one that was written by Spooky and I don't think I could ever create new peds with it. I can load models in order to re-skin the player, but not create new peds. Probably something I'm not doing correctly. I'll try to create another player using your parameters and tell you how i get on.

Link to comment
Share on other sites

I am indeed using spookies hook, but i just tested peds and they work fine, it seems to be just create_player that is causing this crash

Link to comment
Share on other sites

Well, I tried spawning players in a loop and could spawn seven plus the original player, just as expected. Trying to spawn more would result in the scripting engine seizing up, as expected.

 

Did your game actually freeze, or were you able to spawn the extra seven but found that it was the print to file that failed? If it was the print to file, that could be down to the fact that (AFAIK) operations such as file print are often done by the operating system "in its own good time", and with the script engine jamming, those additional file prints never get done.

 

Edit: I tried printing to file as I spawned players...and if I spawn up 7 players i get a soft crash on exiting the game. More than that and I suffer a hard crash and reboot.

Edited by Cowpat
Link to comment
Share on other sites

 

case VK_NUMLOCK: 	{   DWORD Thing;   ScriptCommand ( &create_player, 0, 0.0, 0.0, 0.0, &Thing );   MessageBox ( 0, "Created Player", "Synchronicity", 0 ); 	}

 

 

Now i've just used that and it's crashing me confused.gif , this is without any tampering, and it is a very hard crash most often causing me to force the comp into sleep mode and reboot it

Link to comment
Share on other sites

You're wasting your time trying to pop up a message box in full-screen mode. I just tested it, and could get a message box to appear in windowed mode. Anyone else know how to do it in full-screen? Very handy for debugging.

 

Edit: Why don't I just do 60 secs of testing and answer my own question.

 

MessageBox ( 0, "Created Player", "Synchronicity", MB_TOPMOST );

 

sarcasm.gif

Edited by Cowpat
Link to comment
Share on other sites

ModelingMan
Anyone else know how to do it in full-screen? Very handy for debugging.

Use the game's help box in the top left corner to print messages instead of MessageBox. The memory address(es) should be in the pinned topics.

abstract_sig.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.