I've modified the grandlarc.pwn and added my own spawn areas and other things..
But when I play the game it's normal except for this. (city name & the lshift to stop animation)
Even if I change cities it appears like this. How do I fix this?
Here's the code: Please tell me what I did wrong.
Код:
//----------------------------------------------------------
//
// GRAND LARCENY V2
// A freeroam gamemode for SA-MP 0.3 | Modified by h-chan@live.com
//
//----------------------------------------------------------
#include <a_samp>
#include <core>
#include <float>
#include "../include/gl_common.inc"
#include "../include/gl_spawns.inc"
#pragma tabsize 0
#pragma unused gMedicalSpawns, gPoliceSpawns, thisanimid, lastanimid
//----------------------------------------------------------
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_NORMAL_PLAYER 0xFFBB7777
#define CITY_LOS_SANTOS 0
#define CITY_SAN_FIERRO 1
#define CITY_LAS_VENTURAS 2
#define MILITARY_BASE 3
new total_vehicles_from_files=0;
// Class selection globals
new gPlayerCitySelection[MAX_PLAYERS];
new gPlayerHasCitySelected[MAX_PLAYERS];
new gPlayerLastCitySelectionTick[MAX_PLAYERS];
new Text:txtClassSelHelper;
new Text:txtLosSantos;
new Text:txtSanFierro;
new Text:txtLasVenturas;
new Text:txtMilitaryBase;
new thisanimid=0;
new lastanimid=0;
//----------------------------------------------------------
main()
{
print("\n---------------------------------------");
print("Running Grand Larceny V2 - by h-chan@live.com\n");
print("---------------------------------------\n");
}
//----------------------------------------------------------
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"This server is still on ~y~beta ~w~stage.",3000,4);
SendClientMessage(playerid,COLOR_WHITE,"Welcome, player.");
// class selection init vars
gPlayerCitySelection[playerid] = -1;
gPlayerHasCitySelected[playerid] = 0;
gPlayerLastCitySelectionTick[playerid] = GetTickCount();
//New Military Base, Hangar and Control Tower
RemoveBuildingForPlayer(playerid, 3366, 276.6563, 2023.7578, 16.6328, 0.25);
RemoveBuildingForPlayer(playerid, 3366, 276.6563, 1989.5469, 16.6328, 0.25);
RemoveBuildingForPlayer(playerid, 3366, 276.6563, 1955.7656, 16.6328, 0.25);
RemoveBuildingForPlayer(playerid, 1411, 347.1953, 1799.2656, 18.7578, 0.25);
RemoveBuildingForPlayer(playerid, 1411, 342.9375, 1796.2891, 18.7578, 0.25);
RemoveBuildingForPlayer(playerid, 16094, 191.1406, 1870.0391, 21.4766, 0.25);
RemoveBuildingForPlayer(playerid, 16096, 120.5078, 1934.0313, 19.8281, 0.25);
RemoveBuildingForPlayer(playerid, 3268, 276.6563, 2023.7578, 16.6328, 0.25);
RemoveBuildingForPlayer(playerid, 3268, 276.6563, 1989.5469, 16.6328, 0.25);
RemoveBuildingForPlayer(playerid, 3268, 276.6563, 1955.7656, 16.6328, 0.25);
CreateObject(19312, 191.14, 1870.04, 21.48, 0.00, 0.00, 0.00);
CreateObject(19313, 121.54, 1941.62, 21.64, 0.00, 0.00, 0.00);
CreateObject(19313, 286.09, 1833.63, 19.91, 0.00, 0.00, 90.00);
CreateObject(3095, 268.78, 1883.93, 16.01, 0.00, 0.00, 0.00);
CreateObject(2927, 215.89, 1875.42, 13.82, 0.00, 0.00, 0.00);
CreateObject(2927, 211.83, 1875.42, 13.82, 0.00, 0.00, 0.00);
CreateObject(3117, 246.04, 1862.89, 19.44, 0.00, 0.00, 38.88);
CreateObject(16644, 342.09, 1795.80, 13.40, 0.00, 90.00, -56.22);
CreateObject(16644, 344.25, 1797.24, 13.40, 0.00, 90.00, -56.34);
CreateObject(16644, 346.42, 1798.71, 13.40, 0.00, 90.00, -55.98);
CreateObject(16644, 348.59, 1800.18, 13.40, 0.00, 90.00, -55.26);
CreateObject(16098, 253.89, 1975.14, 21.27, 0.00, 0.00, 0.00);
CreateObject(16098, 331.53, 1975.14, 21.27, 0.00, 0.00, 0.00);
CreateObject(3268, 280.09, 2048.76, 16.61, 0.00, 0.00, 90.00);
CreateObject(10763, 280.45, 1968.76, 29.75, 0.00, 0.00, 0.00);
CreateObject(1498, 264.48, 1974.52, 16.63, 0.00, 0.00, 90.00);
CreateObject(3268, 254.29, 2022.98, 16.61, 0.00, 0.00, 180.00);
CreateObject(3279, 327.07, 1975.15, 16.63, 0.00, 0.00, 0.00);
CreateObject(16096, 148.41, 1938.90, 19.83, 356.86, 0.00, 3.14);
return 1;
}
//----------------------------------------------------------
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
new randSpawn = 0;
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, 100000);
if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_LosSantos));
SetPlayerPos(playerid,
gRandomSpawns_LosSantos[randSpawn][0],
gRandomSpawns_LosSantos[randSpawn][1],
gRandomSpawns_LosSantos[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_SanFierro));
SetPlayerPos(playerid,
gRandomSpawns_SanFierro[randSpawn][0],
gRandomSpawns_SanFierro[randSpawn][1],
gRandomSpawns_SanFierro[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]);
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
SetPlayerPos(playerid,
gRandomSpawns_LasVenturas[randSpawn][0],
gRandomSpawns_LasVenturas[randSpawn][1],
gRandomSpawns_LasVenturas[randSpawn][2]);
SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]);
}
else if(MILITARY_BASE == gPlayerCitySelection[playerid]) {
randSpawn = random(sizeof(gMilitarySpawns));
SetPlayerPos(playerid,
gMilitarySpawns[randSpawn][0],
gMilitarySpawns[randSpawn][1],
gMilitarySpawns[randSpawn][2]);
SetPlayerFacingAngle(playerid,gMilitarySpawns[randSpawn][3]);
}
//SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
SetPlayerSkillLevel(playerid,22,999);
SetPlayerSkillLevel(playerid,23,999);
SetPlayerSkillLevel(playerid,23,999);
SetPlayerSkillLevel(playerid,25,999);
SetPlayerSkillLevel(playerid,26,999);
SetPlayerSkillLevel(playerid,27,999);
SetPlayerSkillLevel(playerid,28,999);
SetPlayerSkillLevel(playerid,29,999);
SetPlayerSkillLevel(playerid,30,999);
SetPlayerSkillLevel(playerid,31,999);
SetPlayerSkillLevel(playerid,32,999);
SetPlayerSkillLevel(playerid,33,999);
SetPlayerSkillLevel(playerid,34,999);
GivePlayerWeapon(playerid,31,550);
GivePlayerWeapon(playerid,27,77);
GivePlayerWeapon(playerid,34,500);
//GivePlayerWeapon(playerid,WEAPON_MP5,100);
TogglePlayerClock(playerid, 0);
return 1;
}
//----------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
new playercash;
// if they ever return to class selection make them city
// select again first
gPlayerHasCitySelected[playerid] = 0;
if(killerid == INVALID_PLAYER_ID) {
ResetPlayerMoney(playerid);
} else {
playercash = GetPlayerMoney(playerid);
if(playercash > 0) {
GivePlayerMoney(killerid, playercash);
ResetPlayerMoney(playerid);
}
}
return 1;
}
//----------------------------------------------------------
ClassSel_SetupCharSelection(playerid)
{
if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
SetPlayerInterior(playerid,11);
SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
SetPlayerFacingAngle(playerid,0.0);
SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
}
else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516);
SetPlayerFacingAngle(playerid,181.0);
SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516);
SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516);
}
else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,349.0453,193.2271,1014.1797);
SetPlayerFacingAngle(playerid,286.25);
SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875);
SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797);
}
else if(gPlayerCitySelection[playerid] == MILITARY_BASE) {
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,245.6897,1860.4257,14.0840,184.4610);
SetPlayerFacingAngle(playerid,0.0);
SetPlayerCameraPos(playerid,246.2556,1857.8766,14.0840,3.2076);
SetPlayerCameraLookAt(playerid,245.6897,1860.4257,14.0840,184.4610);
}
}
//----------------------------------------------------------
// Used to init textdraws of city names
ClassSel_InitCityNameText(Text:txtInit)
{
TextDrawUseBox(txtInit, 0);
TextDrawLetterSize(txtInit,1.25,3.0);
TextDrawFont(txtInit, 0);
TextDrawSetShadow(txtInit,0);
TextDrawSetOutline(txtInit,1);
TextDrawColor(txtInit,0xEEEEEEFF);
TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
}
//----------------------------------------------------------
ClassSel_InitTextDraws()
{
// Init our observer helper text display
txtLosSantos = TextDrawCreate(10.0, 380.0, "Los Santos");
ClassSel_InitCityNameText(txtLosSantos);
txtSanFierro = TextDrawCreate(10.0, 380.0, "San Fierro");
ClassSel_InitCityNameText(txtSanFierro);
txtLasVenturas = TextDrawCreate(10.0, 380.0, "Las Venturas");
ClassSel_InitCityNameText(txtLasVenturas);
txtLasVenturas = TextDrawCreate(10.0, 380.0, "Military Base");
ClassSel_InitCityNameText(txtMilitaryBase);
// Init our observer helper text display
txtClassSelHelper = TextDrawCreate(10.0, 415.0,
" Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
TextDrawUseBox(txtClassSelHelper, 1);
TextDrawBoxColor(txtClassSelHelper,0x222222BB);
TextDrawLetterSize(txtClassSelHelper,0.3,1.0);
TextDrawTextSize(txtClassSelHelper,400.0,40.0);
TextDrawFont(txtClassSelHelper, 2);
TextDrawSetShadow(txtClassSelHelper,0);
TextDrawSetOutline(txtClassSelHelper,1);
TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
TextDrawColor(txtClassSelHelper,0xFFFFFFFF);
}
//----------------------------------------------------------
ClassSel_SetupSelectedCity(playerid)
{
if(gPlayerCitySelection[playerid] == -1) {
gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
}
if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawShowForPlayer(playerid,txtLasVenturas);
TextDrawShowForPlayer(playerid,txtMilitaryBase);
}
else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,-1300.8754,68.0546,129.4823);
SetPlayerCameraLookAt(playerid,-1817.9412,769.3878,132.6589);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawShowForPlayer(playerid,txtLasVenturas);
TextDrawShowForPlayer(playerid,txtMilitaryBase);
}
else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390);
SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawShowForPlayer(playerid,txtLasVenturas);
TextDrawShowForPlayer(playerid,txtMilitaryBase);
}
else if(gPlayerCitySelection[playerid] == MILITARY_BASE) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid, 10.8800, 2134.1299, 80.1100);
SetPlayerCameraLookAt(playerid, 11.6400, 2133.4600, 79.8500);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawShowForPlayer(playerid,txtLasVenturas);
TextDrawShowForPlayer(playerid,txtMilitaryBase);
}
}
//----------------------------------------------------------
ClassSel_SwitchToNextCity(playerid)
{
gPlayerCitySelection[playerid]++;
if(gPlayerCitySelection[playerid] > MILITARY_BASE) {
gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
}
PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
gPlayerLastCitySelectionTick[playerid] = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
//----------------------------------------------------------
ClassSel_SwitchToPreviousCity(playerid)
{
gPlayerCitySelection[playerid]--;
if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) {
gPlayerCitySelection[playerid] = MILITARY_BASE;
}
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
gPlayerLastCitySelectionTick[playerid] = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
//----------------------------------------------------------
ClassSel_HandleCitySelection(playerid)
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(gPlayerCitySelection[playerid] == -1) {
ClassSel_SwitchToNextCity(playerid);
return;
}
// only allow new selection every ~500 ms
if( (GetTickCount() - gPlayerLastCitySelectionTick[playerid]) < 500 ) return;
if(Keys & KEY_FIRE) {
gPlayerHasCitySelected[playerid] = 1;
TextDrawHideForPlayer(playerid,txtClassSelHelper);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawHideForPlayer(playerid,txtLasVenturas);
TextDrawHideForPlayer(playerid,txtMilitaryBase);
TogglePlayerSpectating(playerid,0);
return;
}
if(lr > 0) {
ClassSel_SwitchToNextCity(playerid);
}
else if(lr < 0) {
ClassSel_SwitchToPreviousCity(playerid);
}
}
//----------------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return 1;
if(gPlayerHasCitySelected[playerid]) {
ClassSel_SetupCharSelection(playerid);
return 1;
} else {
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
TogglePlayerSpectating(playerid,1);
TextDrawShowForPlayer(playerid, txtClassSelHelper);
gPlayerCitySelection[playerid] = -1;
}
}
return 0;
}
//----------------------------------------------------------
public OnGameModeInit()
{
SetGameModeText("Beta Testing");
ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
ShowNameTags(1);
SetNameTagDrawDistance(40.0);
EnableStuntBonusForAll(1);
SetWeather(2);
SetWorldTime(11);
UsePlayerPedAnims();
//ManualVehicleEngineAndLights();
//LimitGlobalChatRadius(300.0);
//DisableInteriorEnterExits();
ClassSel_InitTextDraws();
// Male Characters
AddPlayerClass(283,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
AddPlayerClass(285,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
AddPlayerClass(286,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
AddPlayerClass(287,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
//Female Characters
AddPlayerClass(169,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
AddPlayerClass(226,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
// SPECIAL
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt");
// LAS VENTURAS
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");
// SAN FIERRO
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");
// LOS SANTOS
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");
// OTHER AREAS
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/military_base.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");
printf("Total vehicles from files: %d",total_vehicles_from_files);
return 1;
}
//----------------------------------------------------------
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(IsPlayerNPC(playerid)) return 1;
// changing cities by inputs
if( !gPlayerHasCitySelected[playerid] &&
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
ClassSel_HandleCitySelection(playerid);
return 1;
}
return 1;
}