GTAMP.com

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.

Tip by [DAFE]: The game automatically gets rid of wrecked cars declared with PARKED_CAR_DATA but not cars declared with CAR_DATA.

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

These commands will instantly make the game go out of sync. If you know of others (I haven't tested every command in multiplayer) then contact me.

START_BONUS_CHECK (this can be used to display messages to only one player but if you do anything else inside the check, the game will go out of sync).

WARP_FROM_CAR_TO_POINT

SET_ALL_CONTROLS_STATUS

ROAD_BLOCK_TANK_MAN

DECLARE_POLICELEVEL (6) // Army causes desync

Do not spawn a car on top of a player unless you want weird results to happen and the game to go unstable.

Comments (1) Trackbacks (0)

Leave a comment


Trackbacks are disabled.