Detaljan opis problema:Neznam odakle da poÄnema sa komandama
Dio skripte:
Ma evo cjela skripta
//----------------------------------------------------------
//
// BETA v1.0
//
//
//----------------------------------------------------------
#include
#include
#include
#include "../include/gl_common.inc"
#include "../include/gl_spawns.inc"
#pragma tabsize 0
//----------------------------------------------------------
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_NORMAL_PLAYER 0xFFBB7777
#define CITY_LOS_SANTOS 0
#define CITY_SAN_FIERRO 1
#define CITY_LAS_VENTURAS 2
new total_vehicles_from_files=0;
// Class selection globals
new gPlayerCitySelection;
new gPlayerHasCitySelected;
new gPlayerLastCitySelectionTick;
new Text:txtClassSelHelper;
new Text:txtLosSantos;
new Text:txtSanFierro;
new Text:txtLasVenturas;
new thisanimid=0;
new lastanimid=0;
//----------------------------------------------------------
main()
{
print("\n---------------------------------------");
print(" BETA v1.0\n");
print("---------------------------------------\n");
}
//----------------------------------------------------------
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~SAMP",3000,4);
SendClientMessage(playerid,COLOR_WHITE,"Welcome to RolePlay");
// class selection init vars
gPlayerCitySelection = -1;
gPlayerHasCitySelected = 0;
gPlayerLastCitySelectionTick = GetTickCount();
//SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
/*
Removes vending machines
RemoveBuildingForPlayer(playerid, 1302, 0.0, 0.0, 0.0, 6000.0);
RemoveBuildingForPlayer(playerid, 1209, 0.0, 0.0, 0.0, 6000.0);
RemoveBuildingForPlayer(playerid, 955, 0.0, 0.0, 0.0, 6000.0);
RemoveBuildingForPlayer(playerid, 1775, 0.0, 0.0, 0.0, 6000.0);
RemoveBuildingForPlayer(playerid, 1776, 0.0, 0.0, 0.0, 6000.0);
*/
/*
new ClientVersion;
GetPlayerVersion(playerid, ClientVersion, 32);
printf("Player %d reports client version: %s", playerid, ClientVersion);*/
return 1;
}
//----------------------------------------------------------
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
new randSpawn = 0;
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, 50);
if(CITY_LOS_SANTOS == gPlayerCitySelection) {
randSpawn = random(sizeof(gRandomSpawns_LosSantos));
SetPlayerPos(playerid,
gRandomSpawns_LosSantos,
gRandomSpawns_LosSantos,
gRandomSpawns_LosSantos);
SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos);
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection) {
randSpawn = random(sizeof(gRandomSpawns_SanFierro));
SetPlayerPos(playerid,
gRandomSpawns_SanFierro,
gRandomSpawns_SanFierro,
gRandomSpawns_SanFierro);
SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro);
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection) {
randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
SetPlayerPos(playerid,
gRandomSpawns_LasVenturas,
gRandomSpawns_LasVenturas,
gRandomSpawns_LasVenturas);
SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas);
}
//SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
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 = 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 == 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);
}
}
//----------------------------------------------------------
// 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);
// 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 == -1) {
gPlayerCitySelection = CITY_LOS_SANTOS;
}
if(gPlayerCitySelection == CITY_LOS_SANTOS) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
TextDrawShowForPlayer(playerid,txtLosSantos);
}
}
//----------------------------------------------------------
ClassSel_SwitchToNextCity(playerid)
{
gPlayerCitySelection++;
if(gPlayerCitySelection > CITY_LAS_VENTURAS) {
gPlayerCitySelection = CITY_LOS_SANTOS;
}
PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
gPlayerLastCitySelectionTick = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
//----------------------------------------------------------
ClassSel_SwitchToPreviousCity(playerid)
{
gPlayerCitySelection--;
if(gPlayerCitySelection < CITY_LOS_SANTOS) {
gPlayerCitySelection = CITY_LAS_VENTURAS;
}
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
gPlayerLastCitySelectionTick = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
//----------------------------------------------------------
ClassSel_HandleCitySelection(playerid)
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(gPlayerCitySelection == -1) {
ClassSel_SwitchToNextCity(playerid);
return;
}
// only allow new selection every ~500 ms
if( (GetTickCount() - gPlayerLastCitySelectionTick) < 500 ) return;
if(Keys & KEY_FIRE) {
gPlayerHasCitySelected = 1;
TextDrawHideForPlayer(playerid,txtClassSelHelper);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawHideForPlayer(playerid,txtLasVenturas);
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) {
ClassSel_SetupCharSelection(playerid);
return 1;
} else {
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
TogglePlayerSpectating(playerid,1);
TextDrawShowForPlayer(playerid, txtClassSelHelper);
gPlayerCitySelection = -1;
}
}
return 0;
}
//----------------------------------------------------------
public OnGameModeInit()
{
//------------------------------------------------------------
CreateObject(980,2360.80004883,-1271.30004883,23.70000076,0.00000000,0.00000000,90.00000000); //object(airportgate) (1)
CreateObject(980,2313.80004883,-1217.50000000,23.89999962,0.00000000,0.00000000,270.00000000); //object(airportgate) (2)
CreateObject(2238,2335.69995117,-1266.40002441,27.39999962,0.00000000,0.00000000,0.00000000); //object(cj_lava_lamp) (1)
CreateObject(2238,2333.80004883,-1266.40002441,27.39999962,0.00000000,0.00000000,0.00000000); //object(cj_lava_lamp) (2)
CreateObject(2113,2343.80004883,-1266.00000000,30.70000076,0.00000000,0.00000000,180.00000000); //object(baskgamenet) (1)
CreateObject(2114,2343.39990234,-1265.90002441,27.10000038,0.00000000,0.00000000,0.00000000); //object(basketball) (1)
CreateObject(1710,2357.00000000,-1271.69995117,27.00000000,0.00000000,0.00000000,270.00000000); //object(kb_couch07) (1)
CreateObject(2370,2354.00000000,-1273.90002441,27.00000000,0.00000000,0.00000000,0.00000000); //object(shop_set_1_table) (1)
CreateObject(1429,2354.69995117,-1273.50000000,28.10000038,0.00000000,0.00000000,90.00000000); //object(dyn_tv) (1)
CreateObject(3800,2353.60009766,-1270.19995117,27.00000000,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (1)
CreateObject(3800,2353.60009766,-1269.09997559,27.00000000,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (2)
CreateObject(3800,2353.60009766,-1268.00000000,27.00000000,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (3)
CreateObject(3800,2353.60009766,-1270.19995117,28.10000038,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (4)
CreateObject(3800,2353.60009766,-1269.09997559,28.10000038,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (5)
CreateObject(3800,2353.60009766,-1270.19995117,29.20000076,0.00000000,0.00000000,0.00000000); //object(acbox4_sfs) (6)
CreateObject(2964,2358.00000000,-1268.30004883,27.00000000,0.00000000,0.00000000,0.00000000); //object(k_pooltablesm) (1)
CreateObject(1686,2329.39990234,-1259.30004883,21.50000000,0.00000000,0.00000000,0.00000000); //object(petrolpumpnew) (1)
CreateObject(1583,2338.19995117,-1275.40002441,21.50000000,0.00000000,0.00000000,0.00000000); //object(tar_gun2) (1)
CreateObject(1775,2353.50000000,-1277.00000000,28.10000038,0.00000000,0.00000000,90.00000000); //object(cj_sprunk1) (1)
CreateObject(2036,2354.60009766,-1274.09997559,27.89999962,0.00000000,0.00000000,0.00000000); //object(cj_psg1) (1)
CreateObject(11496,2355.50000000,-1273.30004883,33.00000000,0.00000000,0.00000000,0.00000000); //object(des_wjetty) (1)
CreateObject(3648,2395.60009766,-1295.30004883,27.29999924,0.00000000,0.00000000,0.00000000); //object(ganghous02_lax) (1)
CreateObject(3590,2395.30004883,-1310.80004883,27.29999924,0.00000000,0.00000000,90.00000000); //object(compfukhouse2) (1)
//---------------------------------------[MEH RADIONA]---------------------------------------------
CreateObject(12943,317.00000000,-1801.59997559,3.59999990,0.00000000,0.00000000,0.00000000); //object(sw_shed07) (1)
CreateObject(12942,317.00000000,-1801.59997559,3.59999990,1.00000000,0.00000000,0.00000000); //object(sw_shedinterior01) (1)
CreateObject(11102,312.20001221,-1797.69995117,5.80000019,0.00000000,0.00000000,90.00000000); //object(burgalrydoor_sfs) (2)
CreateObject(10282,314.70001221,-1801.50000000,4.59999990,0.00000000,0.00000000,90.00000000); //object(mich_int_sfe) (1)
CreateObject(14826,313.79998779,-1795.19995117,4.30000019,0.00000000,0.00000000,0.00000000); //object(int_kbsgarage2) (1)
//-----------------------------------------------------------------------------------------------------
SetGameModeText("SAMP");
ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
ShowNameTags(1);
SetNameTagDrawDistance(40.0);
EnableStuntBonusForAll(0);
DisableInteriorEnterExits();
SetWeather(2);
SetWorldTime(11);
//UsePlayerPedAnims();
//ManualVehicleEngineAndLights();
//LimitGlobalChatRadius(300.0);
ClassSel_InitTextDraws();
// Player Class
//-----------------------------------------------
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/cars.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/vlakovi.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/letjelice.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/brodovi.txt");
total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ostala_vozila.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 &&
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
ClassSel_HandleCitySelection(playerid);
return 1;
}
// No weapons in interiors
if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
SetPlayerArmedWeapon(playerid,0); // fists
return 0; // no syncing until they change their weapon
}
// Don't allow minigun
if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) {
Kick(playerid);
return 0;
}
/* No jetpacks allowed
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
Kick(playerid);
return 0;
}*/
/* For testing animations
new msg[128+1];
new animlib[32+1];
new animname[32+1];
thisanimid = GetPlayerAnimationIndex(playerid);
if(lastanimid != thisanimid)
{
GetAnimationName(thisanimid,animlib,32,animname,32);
format(msg, 128, "anim(%d,%d): %s %s", lastanimid, thisanimid, animlib, animname);
lastanimid = thisanimid;
SendClientMessage(playerid, 0xFFFFFFFF, msg);
}*/
return 1;
}
