GTA2 scripting
This page contains some advanced GTA2 scripting advice. If you are a beginner then I suggest checking Project Cerbera for GTA2 scripting tutorials.
GTA2 scripting problems
You should never initially spawn a player on top of a weapon pickup. The player should start at least one cube away. Respawn locations can be above weapon pickups.
The GIVE_WEAPON command will crash if you try to give a weapon to a player that doesn’t exist. If you want to use that command in a multiplayer script then you must check if the player exists by using the CHECK_CHARACTER_HEALTH command.
Example:
IF ( CHECK_CHARACTER_HEALTH ( P1 , 0 ) )
GIVE_WEAPON ( P1 , ROCKET_LAUNCHER )
ENDIF
This checks to see if a player’s health is more than zero before giving them a weapon. It will never try to give a weapon to a player who quit or doesn’t exist because their health will never be above zero.
Code that shouldn’t be used in multiplayer
WARP_FROM_CAR_TO_POINT and SET_ALL_CONTROLS_STATUS commands will instantly make the game go out of sync.
Do not spawn a car on top of a player unless you want weird results to happen and the game to go unstable.




