Nothing works for me :(
#1

[Resolved] = Thanks for the replys
Reply
#2

Here we go again BUMP!
Reply
#3

so what are the problems?
-age dont save
-gender dont save
anything else?
Reply
#4

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
so what are the problems?
-age dont save
-gender dont save
anything else?
Yeah Thats all im worried about right now
Reply
#5

cant compile coz i dont have your includes but try this
pawn Код:
/*******************************************************************************
*********A*******RRRRRRR*****SSSS***********************************************
********AAA******RR*****RR*SS****SS*********************************************
*******AA*AA*****RR*****RR*SS***************************************************
******AA***AA****RRRRRRR*****SSSS*************AdVance Register System***************
*****AAAAAAAAA***RR***RR*********SS*********************************************
****AA*******AA**RR****RR**SS****SS*********************************************
***AA*********AA*RR*****RR***SSSS***********************************************
*******************************************************************************/

//==============(includes)======================================================
#include <a_samp>
#include <dudb>
#include <float>
#include <streamer>
#include <progress>
//===============(notused)======================================================
#pragma unused ret_memcpy
//=======================(Userfiles)============================================
#define SERVER_USER_FILE "AdvanceRS/accounts/%s.ini"
//==============================================================================

//===============================[MAIN SETTINGS]================================ This right here i dont know the name who made it
#define GAMEMODE    "ARS" // This is what the gamemode text will be set to.
#define GAMEMODE_USE_VERSION    "Yes" // This shows the Server name and the version in Gamemode text, if set to "No" it will only display the gamemode name.
#define MAP_NAME    "San Andreas" // This is what the map name will be set to.
#define SERVER_NAME "AdVance Register System" // This is what the hostname/servername will be set to.
#define WEBSITE "www.hypertentions.com" // This is what the website will be set to.
#define VERSION "v0.1" // Script Version
#define DEVELOPER   "BuzzBOMB" // Developer Name.
#define PASSWORD    "" // Server Password
#define SCRIPT_LINES   801 // For printing the script lines amount, unfortunately it has to be updated manually.
//==============================================================================

//=================================[DEFINES]====================================
#define Holding(%0) \
    ((newkeys & (%0)) == (%0))
#define MaxFire 500 // How many fires max.?
#define SLOTS 250
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//===========================Colors=============================================
#define DARKBLUE 0x2641FEAA
#define WHITE 0xFFFFFFAA
#define BLUE 0x2641FEAA
#define GREY 0x3333CCAA
#define ORANGE 0xFF9900AA
#define RED 0xA10000AA
#define YELLOW 0xFFFF00AA
#define YELLOW2 0xF5DEB3AA
#define MEDIUMBLUE 0x1ED5C7FF
#define LIGHTYELLOW2 0xE0EA64AA
//=======================================[FORWARDS]=============================
forward OnFireKill(ID, killerid);
forward VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z);
forward HealthDown();
forward SafeGivePlayerWeapon(plyid, weaponid, ammo);
forward SafeSetPlayerPos(playerid, Float:x, Float:y, Float:z);
forward GameModeRestart(playerid);

forward ProgressBar();
forward AgeSection(playerid, Age[]);
forward GenderSection(playerid, Gender[]);
//forward LocationSection(playerid, listitem, location[]);
forward Statbarupdate(playerid);
forward speedometer(playerid); // This Forwards The Timer To Our Function

//=============================================(New (Defines)===================
new gPlayerLogged[MAX_PLAYERS];
new Bar:vhealth[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
new FireObj[MaxFire],Float:FirePos[MaxFire][3],TotalFires = 0,FireHealth[MaxFire],FireHealthMax[MaxFire];
new Text3D:FireText[MaxFire];
new CreatedCars[1000];
new CreatedCar = 0;
//==============================ExternalRP Speedo===============================
new Float:svx[MAX_PLAYERS]; // Holds Velocity X
new Float:svy[MAX_PLAYERS]; // Holds Velocity Y
new Float:svz[MAX_PLAYERS]; // Holds Velocity Z
new Float:speed1[MAX_PLAYERS]; // This Is What Our Forumula Outputs
new speed2[MAX_PLAYERS]; // This Is The Output When The Forumula's Ouput Is Round
new speed3[MAX_PLAYERS][256]; // This Is The Text That Is Displayed To The User
new Text:MPH[MAX_PLAYERS]; // This Holds The Textdraw's ID
new stimer[MAX_PLAYERS]; // This Holds The Timer's ID (Used To Refresh Speed)
//==============================================================================

main()
{
    print("=====================================================================");
    printf(" %s - %s by %s loaded.", GAMEMODE,MAP_NAME,DEVELOPER);
    printf(" Server Name: %s", SERVER_NAME);
    if (!strcmp("Yes", GAMEMODE_USE_VERSION, true)) {
    printf(" Gamemode: %s - %s", GAMEMODE,VERSION); } else {
    printf(" Gamemode: %s", GAMEMODE); } // Checking the "GAMEMODE_USE_VERSION" define, if "Yes" then set the gamemode text to the gamemode name & version, else set it to just the gamemode name.
    printf(" Version: %s", VERSION);
    printf(" Map: %s", MAP_NAME);
    printf(" Website: %s", WEBSITE);
    printf(" Developer: %s", DEVELOPER);
    printf(" Current Script Lines: %d", SCRIPT_LINES);
    print("=====================================================================");
}
enum pInfo
{
    pAccount,
    pFirstname,
    pLastname,
    pAge,
    pGender[10],
    pChar,
    pAdminLevel,
    pCash,
    pScore,
    pReg,
    pId,
    pHealth,
    pArmour,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//==============================================================================

public GameModeRestart(playerid)
{
    for(new i = 0; i < 120; i++)
    {
        SendClientMessage(i,0x00," ");
    }
    GameModeExit();
    return 1;
}

public OnGameModeInit()
{
    SetTimer("ProgressBar", 500, 1);
    SetTimer("HealthDown", 600, 1);
//========================= ( TextDraw ) =======================================
    SetGameModeText("gamemode");
    AddPlayerClass(0,1.3173,29.7461,1199.6012,269.1425, 0, 0, 0, 0, 0, 0);
//===============================[DISABLING STUFF]==============================
    ShowPlayerMarkers(0);
    EnableStuntBonusForAll(0); //Disable stunt bonus.
    DisableInteriorEnterExits();//Disable Yellow Markers.
    AllowInteriorWeapons(1);//Allowing weapons inside.
    AllowAdminTeleport(1);
    UsePlayerPedAnims();
    //ShowNameTags(false);
    new sendcmd[128];
//=======================[Setting the servers stats]============================
    if (!strcmp("Yes", GAMEMODE_USE_VERSION, true)) { format(sendcmd, sizeof(sendcmd), "%s - %s", GAMEMODE,VERSION); SetGameModeText(sendcmd); }
    else { SetGameModeText(GAMEMODE); }
    format(sendcmd, sizeof(sendcmd), "hostname %s", SERVER_NAME);
    SendRconCommand(sendcmd);
    format(sendcmd, sizeof(sendcmd), "mapname %s", MAP_NAME);
    SendRconCommand(sendcmd);
    format(sendcmd, sizeof(sendcmd), "weburl %s", WEBSITE);
    SendRconCommand(sendcmd);
    if (strlen(PASSWORD) != 0) { format(sendcmd, sizeof(sendcmd), "password %s", PASSWORD); SendRconCommand(sendcmd); }
//==============================================================================
    //AddPlayerClass(217,1683.4304,-2329.0571,13.5469,2.7666,-1,-1,-1,-1,-1,-1);
    //AddPlayerClass(211,1683.4304,-2329.0571,13.5469,2.7666,-1,-1,-1,-1,-1,-1);
 //==========================================objects============================
    CreateDynamicObject(997, 1511.6610107422,-1737.5157470703,12.546875,0.000000,0.000000,0); //Barriers
    CreateDynamicObject(997, 1506.41015625,-1737.474609375,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1501.9569091797,-1737.5524902344,12.546875,0.000000,0.000000,269.99996948242);
    CreateDynamicObject(997, 1501.91015625,-1737.4965820313,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1440.2351074219,-1737.5192871094,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1444.734375,-1737.4965820313,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1449.234375,-1737.4741210938,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1453.734375,-1737.5087890625,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1456.984375,-1737.5341796875,12.546875,0.000000,0.000000,270);
    CreateDynamicObject(997, 1458.2502441406,-1740.7368164063,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1463.25,-1740.7119140625,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1468.25,-1740.6875,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1472.75,-1740.6655273438,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1477.5,-1740.6418457031,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1482.5,-1740.6171875,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1487.5,-1740.5927734375,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1492.5,-1740.568359375,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997, 1497.25,-1740.5451660156,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(1216, 1546.8270263672,-1679.4388427734,13.252343177795,0.000000,0.000000,0);
    CreateDynamicObject(1216, 1498.7451171875,-1749.9692382813,15.137314796448,0.000000,0.000000,179.99450683594);
    CreateDynamicObject(1216, 1497.7451171875,-1749.9702148438,15.137314796448,0.000000,0.000000,179.99450683594);
    CreateDynamicObject(1216, 1496.7451171875,-1749.9711914063,15.137314796448,0.000000,0.000000,179.99450683594);
    CreateDynamicObject(1216, 1495.7451171875,-1749.9721679688,15.137314796448,0.000000,0.000000,179.99450683594);
    CreateDynamicObject(1216, 1499.7451171875,-1749.9672851563,15.137314796448,0.000000,0.000000,179.99450683594);
    CreateDynamicObject(1363, 1479.4821777344,-1696.5661621094,13.883237838745,0.000000,0.000000,0);
    CreateDynamicObject(6299, 1478.7175292969,-1702.5129394531,15.067262649536,0.000000,0.000000,0);
    CreateDynamicObject(8838, 1458.3616943359,-1723.6131591797,14.066276550293,0.000000,0.000000,0);
//==================================InfrontofLSPD===============================
    CreateDynamicObject(997,1534.5650634766,-1681.7392578125,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(997,1534.5584716797,-1663.7103271484,12.546875,0.000000,0.000000,0);
    CreateDynamicObject(994,1534.2503662109,-1669.5777587891,12.3828125,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.6629638672,-1683.1982421875,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.6749267578,-1690.9869384766,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.6478271484,-1699.0122070313,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.6872558594,-1707.0780029297,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.7641601563,-1639.7862548828,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.7000732422,-1715.9520263672,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4279785156,-1715.9493408203,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4959716797,-1707.4458007813,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4617919922,-1699.3469238281,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4665527344,-1691.3209228516,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4847412109,-1683.4201660156,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.50390625,-1675.419921875,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4439697266,-1664.1979980469,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4957275391,-1655.8773193359,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4869384766,-1647.9215087891,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.6285400391,-1655.646484375,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.7313232422,-1647.6806640625,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4541015625,-1639.6646728516,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.3753662109,-1631.0419921875,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.3969726563,-1624.7320556641,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.3240966797,-1610.1635742188,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1524.4057617188,-1618.4700927734,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(994,1534.7744140625,-1610.5445556641,12.557809829712,0.000000,0.000000,270.25);
    CreateDynamicObject(994,1534.7408447266,-1602.3645019531,12.557809829712,0.000000,0.000000,270.24719238281);
    CreateDynamicObject(994,1524.3665771484,-1602.2557373047,12.557809829712,0.000000,0.000000,270);
    CreateDynamicObject(5627,1529.5633544922,-1652.4058837891,17.627487182617,0.000000,0.000000,0.000000);
    CreateDynamicObject(997,1539.3813476563,-1666.5086669922,12.546875,0.000000,0.000000,120.25);
    CreateDynamicObject(997,1539.4573974609,-1671.7535400391,12.546875,0.000000,0.000000,90.245361328125);
    CreateDynamicObject(997,1539.4809570313,-1677.1795654297,12.546875,0.000000,0.000000,90.994262695313);
    CreateDynamicObject(997,1537.7913818359,-1681.7630615234,12.546875,0.000000,0.000000,58.994293212891);
    CreateDynamicObject(1257,1522.6159667969,-1672.9154052734,13.826066970825,0.000000,0.000000,180.25);
    CreateDynamicObject(8856,1529.552734375,-1672.568359375,12.523129463196,0.000000,0.000000,0.000000);
    CreateDynamicObject(717,1529.5805664063,-1679.6435546875,12.375651359558,0.000000,0.000000,0.000000);
    CreateDynamicObject(1361,1529.5268554688,-1682.0589599609,13.268992424011,0.000000,0.000000,0.000000);
    CreateDynamicObject(1360,1529.5927734375,-1676.8715820313,13.29767036438,0.000000,0.000000,0.000000);
    CreateDynamicObject(717,1529.53515625,-1665.2647705078,12.375651359558,0.000000,0.000000,0.000000);
    CreateDynamicObject(1361,1529.5550537109,-1663.0560302734,13.268992424011,0.000000,0.000000,0.000000);
    CreateDynamicObject(1360,1529.5701904297,-1668.2518310547,13.27267074585,0.000000,0.000000,0.000000);
    CreateDynamicObject(1231,1529.4968261719,-1672.6125488281,15.181043624878,0.000000,0.000000,0.000000);
//===================================[Prison Gates]=============================
    CreateDynamicObject(18234,2915.5197753906,-810.16534423828,10.046875,0.000000,0.000000,0.000000); // cuntw_shed2_
    CreateDynamicObject(3749,2913.833984375,-786.21203613281,15.871165275574,0.000000,0.000000,272);
    CreateDynamicObject(966,2911.4438476563,-793.18206787109,10.014753341675,0.000000,0.000000,272.25);
    CreateDynamicObject(966,2916.1806640625,-779.29608154297,10.014753341675,0.000000,0.000000,89.994506835938);
//==========================ARS prison barrierturn =============================
    /*CreateDynamicObject(968,2916.1923828125,-779.185546875,10.739757537842,0.000000,89.246948242188,269.99447631836); // Down
    CreateDynamicObject(968,2911.4633789063,-793.31463623047,10.739757537842,0.000000,89.246948242188,92.249969482422); // Down*/

//==============================================================================
    CreateDynamicObject(10244,2909.8803710938,-797.84423828125,12.402437210083,0.000000,0.000000,2.25);
    CreateDynamicObject(16003,2913.7788085938,-786.25317382813,11.435367584229,0.000000,0.000000,181.25);
    CreateDynamicObject(2921,2912.0463867188,-795.18811035156,14.804711341858,0.000000,0.000000,0.000000);
    CreateDynamicObject(2921,2915.6228027344,-777.26055908203,14.941268920898,0.000000,0.000000,182);
//============================ARS State Prison =================================
    CreateDynamicObject(18450,2942.294921875,-785.2333984375,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3022.1745605469,-782.44329833984,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,3100.6831054688,-779.697265625,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3180.4445800781,-776.91864013672,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3258.8688964844,-774.18145751953,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3337.6486816406,-771.43115234375,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3416.0837402344,-768.68676757813,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,3494.5300292969,-765.94647216797,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,3573.4445800781,-763.18273925781,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,3650.9067382813,-760.46209716797,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3730.4431152344,-757.69464111328,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3809.0144042969,-754.95959472656,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3888.9372558594,-752.16552734375,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(18450,3968.7438964844,-749.37335205078,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,4048.5197753906,-746.58703613281,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,4128.36328125,-743.78692626953,9.6940002441406,0.000000,0.000000,181.99952697754);
    CreateDynamicObject(18450,4208.1181640625,-740.99908447266,9.6940002441406,0.000000,0.000000,181.99951171875);
    CreateDynamicObject(8577,4328.0864257813,-754.71032714844,10.871282577515,0.000000,0.000000,92);
    CreateDynamicObject(10828,4247.3071289063,-765.31097412109,8,0.000000,0.000000,272.25);
    CreateDynamicObject(10828,4245.4243164063,-714.33050537109,8,0.000000,0.000000,92.246765136719);
    CreateDynamicObject(10828,4246.7241210938,-737.90911865234,4.349986076355,0.000000,0.000000,272.24670410156);
    CreateDynamicObject(5704,4346.7465820313,-724.85095214844,22.824995040894,0.000000,0.000000,272);
    CreateDynamicObject(5737,4385.513671875,-713.40777587891,15.996788024902,0.000000,0.000000,2);
    CreateDynamicObject(10828,4407.9155273438,-715.40747070313,8,0.000000,0.000000,271.99670410156);
    CreateDynamicObject(10828,4409.0395507813,-753.43804931641,8,0.000000,0.000000,271.99401855469);
    CreateDynamicObject(10828,4410.2426757813,-787.99456787109,8,0.000000,0.000000,271.99401855469);
    CreateDynamicObject(10828,4394.1411132813,-805.197265625,8,0.000000,0.000000,181.99401855469);
    CreateDynamicObject(10828,4261.419921875,-697.37493896484,8,0.000000,0.000000,1.4967041015625);
    CreateDynamicObject(10828,4296.3442382813,-699.53460693359,8,0.000000,0.000000,351.494140625);
    CreateDynamicObject(10828,4331.19921875,-701.53216552734,8,0.000000,0.000000,1.9910888671875);
    CreateDynamicObject(10828,4366.1499023438,-700.33074951172,8,0.000000,0.000000,1.988525390625);
    CreateDynamicObject(10828,4390.7485351563,-699.40679931641,8,0.000000,0.000000,2.238525390625);
    CreateDynamicObject(10828,4409.1499023438,-750.75659179688,8,0.000000,0.000000,271.99401855469);
    CreateDynamicObject(6295,4286.0439453125,-742.28082275391,33.70677947998,0.000000,0.000000,272);
    CreateDynamicObject(10828,4294.9462890625,-702.93389892578,8,0.000000,0.000000,1.9910888671875);
    CreateDynamicObject(10828,4264.2490234375,-703.9951171875,8,0.000000,0.000000,1.988525390625);
    CreateDynamicObject(4874,4259.1865234375,-711.67230224609,13.722280502319,0.000000,0.000000,2);
    CreateDynamicObject(10828,4358.8935546875,-806.41033935547,8,0.000000,0.000000,182.23852539063);
    CreateDynamicObject(10828,4345.6640625,-806.91076660156,8,0.000000,0.000000,182.23573303223);
    CreateDynamicObject(5704,4288.4248046875,-787.32257080078,22.649997711182,0.000000,0.000000,92.24951171875);
    CreateDynamicObject(10828,4310.9008789063,-808.25457763672,8,0.000000,0.000000,182.23573303223);
    CreateDynamicObject(10828,4248.5322265625,-794.41229248047,8,0.000000,0.000000,272.24670410156);
    CreateDynamicObject(10828,4275.6381835938,-809.62658691406,8,0.000000,0.000000,182.23573303223);
    CreateDynamicObject(10828,4265.677734375,-810.15942382813,8,0.000000,0.000000,182.23571777344);
//======================================(interiors)=============================
    CreateDynamicObject(1,2.384830,33.103397,1199.849976,0.000000,0.000000,0); // Character Creation Scene

//==============================================================================
    printf("ARS %d DynamicObjects |>Created!<|'", CountDynamicObjects());

//==============================(vehicles)======================================
    AddStaticVehicleEx(444,562.4805,-1263.3044,17.5756,11.4581,0,6,30000);
    AddStaticVehicleEx(541,543.0609,-1290.8246,16.8670,358.5973,0,6,30000);
    AddStaticVehicleEx(565,535.2302,-1291.4296,16.8673,2.9583,0,6,30000);
    AddStaticVehicleEx(415,539.2599,-1290.7301,17.0128,358.4029,0,6,30000);
    AddStaticVehicleEx(503,553.3989,-1290.7466,17.1423,359.1659,0,6,30000);
    AddStaticVehicleEx(554,549.9384,-1290.8817,17.1417,355.8534,0,6,30000);
    AddStaticVehicleEx(451,546.5211,-1290.4878,16.9533,356.9579,0,6,30000);
    AddStaticVehicleEx(477,556.7828,-1290.7666,17.0049,358.9940,0,6,30000);
//========================(LSPDCARSNTRUCKS)=====================================
    AddStaticVehicleEx(596,1536.5144,-1668.5848,13.1911,22.6003,0,1,30000); // lspdcaroutfront
//========================(LSairportCars)=======================================
    AddStaticVehicleEx(596,1663.0198,-2313.6069,13.2313,88.2658,0,1,30000); // LSAPSecurity
//========================(Publicvehicles)======================================
    AddStaticVehicleEx(541,1559.8295,-2338.4761,13.1874,271.4546,0,6,30000); // car 1
    AddStaticVehicleEx(503,1559.8136,-2331.7449,13.1871,268.5542,0,6,30000); // car 3
    AddStaticVehicleEx(477,1560.0394,-2335.1580,13.1859,267.9830,0,6,30000); // car 2
    AddStaticVehicleEx(554,1560.0558,-2328.5540,13.1862,271.7626,0,6,30000); // car 4
    AddStaticVehicleEx(565,1560.3300,-2325.2305,13.1878,270.5352,0,6,30000); // car 5
    AddStaticVehicleEx(451,1560.5098,-2315.2676,13.1874,269.1917,0,6,30000); // car 6
    AddStaticVehicleEx(444,1546.2843,-2361.3855,13.1943,180.4433,0,6,30000); // car 5
//========================(Hudname Textdraw)=======================================
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

/*public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerInterior(playerid,1);
    SetPlayerPos(playerid, 0.6574,27.6034,1199.5938);
    SetPlayerFacingAngle(playerid, 290.0);
    SetPlayerCameraPos(playerid, 2.6829,30.2539,1200.0781);
    SetPlayerCameraLookAt(playerid, 0.6574,27.6034,1199.5938);
    ClearChat(playerid);
    return 1;
}*/


public OnPlayerConnect(playerid)
{
    new file[256];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    //for(new i = 0; i < MAX_PLAYERS; i++)
    //if(ShowPlayerNameTagForPlayer(i, playerid, false))
    //ShowPlayerNameTagForPlayer(playerid, i, false);
    gPlayerLogged[playerid] = 0;
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Account Not Registered", "Please type a password", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Account Registered", "Please login", "Login", "Leave");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Account", PlayerInfo[playerid][pAccount]);
        dini_IntSet(file, "Level", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "Health", PlayerInfo[playerid][pHealth]);
        dini_IntSet(file, "Armour", PlayerInfo[playerid][pArmour]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "Firstname",PlayerInfo[playerid][pFirstname]);
        dini_IntSet(file, "Lastname",PlayerInfo[playerid][pLastname]);
        dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
        dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender]);
        dini_IntSet(file, "Character",PlayerInfo[playerid][pChar]);
        dini_IntSet(file, "Registration",PlayerInfo[playerid][pReg]);
        dini_IntSet(file, "SSN",PlayerInfo[playerid][pId]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}

public AgeSection(playerid, Age)
{
    new name[MAX_PLAYER_NAME], file[256], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    PlayerInfo[playerid][pAge] = Age;
    dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
       
    return 1;
}

public GenderSection(playerid, Gender[])
{
    new name[MAX_PLAYER_NAME], file[256], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    format(PlayerInfo[playerid][pGender],sizeof(PlayerInfo[playerid][pGender]),"%s",Gender);
    dini_Set(file, "Gender",PlayerInfo[playerid][pGender]);
   
    return 1;
}

/*public LocationSection(playerid, listitem, location[])
{
    if(listitem == 0)
    {
        LocationSection(playerid, "Los Santos");
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
    }
    if(listitem == 1)
    {
        LocationSection(playerid, "Las Ventures");
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
    }
    if(listitem == 2)
    {
        LocationSection(playerid, "San Fierro");
        SetPlayerInterior(playerid,0);
        SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
    }
    TogglePlayerControllable(playerid, 0);
    SendClientMessage(playerid, BLUE, "Thank you For Flying With San Andreas Airlines Have a Nice Day!");
    return 1;
}*/


public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new tmp[256];
    new idx;
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, BLUE, " /fireman /medic /cop /jobhelp /gotocords");
        return 1;
    }
//==================================(FiremanDuty)===============================
    if(strcmp("/fireman",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2707.5549,-1152.6136,51.7996))
            {
                SendClientMessage(playerid, 0xFF0000AA, "You are not at the Firemen Lockers!");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, WHITE, "* You are now On Duty with your Firemen.");
                SetPlayerColor(playerid, 0xAA333300);
                SafeGivePlayerWeapon(playerid, 42, 2500);
                SafeGivePlayerWeapon(playerid, 6, 1);
                SetPlayerSkin(playerid, 279);
            }
        }
        return 1;
    }
//==================================RestartGamMode==============================
    if(strcmp("/gmx",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdminLevel] >= 10)
            {
                GameModeRestart(playerid);
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "You Are Not A Admin");
            }
        }
        return 1;
    }
//=============================== Clear Chat ===================================
    if(strcmp("/clearchat",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdminLevel] >= 1)
            {
                ClearChatForAll();
                GameTextForAll("Chat has Been Cleared!",1000,4);
                return 1;
            }
            else
            {
                GameTextForPlayer(playerid,"YOU ARE NOT A ADMIN!",3000,1);
            }
        }
        return 1;
    }
//==================================Createfire==================================
    if(strcmp("/fire",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            AddFire(X,Y,Z, strval(cmdtext[0]));
        }
    }
    if(strcmp("/gotoplane",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdminLevel] >= 1)
            {
                SetPlayerInterior(playerid,1);
                SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "YOU ARE NOT A ADMIN");
                return 1;
            }
        }
    }
    if(strcmp("/gotolsap",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdminLevel] >= 1)
            {
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "YOU ARE NOT A ADMIN");
                return 0;
            }
        }
    }
    if(strcmp("/skin",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
            return 1;
        }
        return 1;
    }
    if(strcmp("/veh",cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdminLevel] < 2)
            {
                SendClientMessage(playerid, RED, "   you are not authorized to use that command!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, DARKBLUE, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new car;
            car = strval(tmp);
            if(car < 400 || car > 611) { SendClientMessage(playerid, GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, DARKBLUE, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color1;
            color1 = strval(tmp);
            if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, DARKBLUE, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color2;
            color2 = strval(tmp);
            if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid, X,Y,Z);
            new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
            CreatedCars[CreatedCar] = carid;
            CreatedCar ++;
            format(string, sizeof(string), "   Vehicle %d spawned.", carid);
            SendClientMessage(playerid, GREY, string);
        }
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new newkeys,l,u;
    GetPlayerKeys(playerid, newkeys, l, u);
    new i;
    if(Holding(KEY_FIRE))
    {
        if(GetPlayerWeapon(playerid) == 42)
        {
            for(i = 0; i<MaxFire; i++)
            {
                if(IsValidFire(i))
                {
                    if(PlayerFaces(playerid, FirePos[i][0],  FirePos[i][1],  FirePos[i][2], 1) && IsPlayerInRangeOfPoint(playerid, 4, FirePos[i][0],  FirePos[i][1],  FirePos[i][2]))
                    {
                        FireHealth[i]-=2;
                        #if defined Labels
                            new string[128];
                            format(string, sizeof(string), "%d/%d", FireHealth[i], FireHealthMax[i]);
                            Update3DTextLabelText(FireText[i], 0xFFFFFFFF, string);
                            //Delete3DTextLabel(FireText[i]);
                        //FireText[i] = Create3DTextLabel(string, 0xFFFFFFFF, FirePos[i][0],  FirePos[i][1],  FirePos[i][2], 20, 0);
                        #endif
                        if(FireHealth[i] <= 0)
                        {
                            DeleteFire(i);
                            CallRemoteFunction("OnFireDeath", "dd", i, playerid);
                        }
                    }
                }
            }
        }
    }
    return 1;
}

Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,   Float:ObjX, Float:ObjY, Float:ObjZ,   Float:FrX, Float:FrY, Float:FrZ) {

    new Float:TGTDistance;
    TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
    new Float:tmpX, Float:tmpY, Float:tmpZ;
    tmpX = FrX * TGTDistance + CamX;
    tmpY = FrY * TGTDistance + CamY;
    tmpZ = FrZ * TGTDistance + CamZ;
    return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response)
        {
            SendClientMessage( playerid, WHITE, "Fine, have it your way!" );
            Kick( playerid );
        }
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "Account",PlayerInfo[playerid][pAccount]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 1000);
        dini_IntSet(file, "Level",PlayerInfo[playerid][pScore] = 0);
        dini_IntSet(file, "Firstname",PlayerInfo[playerid][pFirstname] = 0);
        dini_IntSet(file, "Lastname",PlayerInfo[playerid][pLastname] = 0);
        dini_IntSet(file, "Age",PlayerInfo[playerid][pAge] = 0);
        dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender] = 0);
        dini_IntSet(file, "Registration",PlayerInfo[playerid][pReg] = 0);
        dini_IntSet(file, "SSN",PlayerInfo[playerid][pId] = 0);
        dini_IntSet(file, "Health",PlayerInfo[playerid][pHealth] = 0);
        dini_IntSet(file, "Armour",PlayerInfo[playerid][pArmour] = 0);
        dini_IntSet(file, "Character",PlayerInfo[playerid][pChar] = 0);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, You Have Been Auto Logged in.", name, inputtext);
        SendClientMessage(playerid, YELLOW, string);
        TogglePlayerControllable(playerid, 0);
        SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
        SetPlayerSkin(playerid, 217);
        ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Age Section","How old are you?","Submit","Cancel");
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response)
        {
            SendClientMessage( playerid, WHITE, "Fine, have it your way!" );
            Kick( playerid );
        }
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're a wrong person", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, RED, "SERVER: Invalid password.  Re-enter your password correctly or leave!");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "This account is registered in our data base.", "Enter your password below, or leave if you're a wrong person", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money"));
            format(string, 128, "You have succesfully logged into your account. %s, Welcome back.", name);
            SendClientMessage(playerid, DARKBLUE, string);
            TogglePlayerControllable(playerid, 0);
            SpawnPlayer(playerid);
        }
    }
    if(dialogid == 3)
    {
        if(!strlen(inputtext))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "Your Age Cannot be Blank");
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Age Section","How old are you?","Submit","Cancel");
            return 1;
        }
        if(!response){ Kick(playerid); PlayerInfo[playerid][pReg] = 1; return 1; }
        if (strval(inputtext) == 0)
        {
            SendClientMessage(playerid, ORANGE, "Invalid Age.");
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Age Section","How old are you?","Submit","Cancel");
            return 1;
        }
        AgeSection(playerid, strval(inputtext));
        PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
        TogglePlayerControllable(playerid, 0);
        SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
        SetPlayerSkin(playerid, 217);
        ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Gender Section","Male\nFemale","Submit","Cancel");
    }
    if(dialogid == 4)
    {
        if(!response){ ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Gender Section","Male\nFemale","Submit","Cancel"); return 1; }
        if(listitem == 0)
        {
            SendClientMessage(playerid, ORANGE, "Okay! So you are a male");
            GenderSection(playerid, "Male");
        }
        if(listitem == 1)
        {
            SendClientMessage(playerid, ORANGE, "Okay! So you are a Female");
            GenderSection(playerid, "Female");
        }
        PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
        TogglePlayerControllable(playerid, 0);
        SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
        SetPlayerSkin(playerid, 217);
        SpawnPlayer(playerid);
        ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"Landing Location","Los Santos\nLas Ventures\nSan Fierro","Submit","Cancel");
    }
    if(dialogid == 5)
    {
        if(!response){ ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"Location Section","Los Santos\nLas Ventures\nSan Fierro","GoTo","Cancel"); return 1; }
        SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid, 1.3173,29.7461,1199.6012);
        SetPlayerSkin(playerid, 217);
        SpawnPlayer(playerid);
        if(listitem == 0)
        {
             SendClientMessage(playerid, ORANGE, "Okay! Landing at Los Santos Airport");
             SetPlayerInterior(playerid,0);
             SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
             SetPlayerSkin(playerid, 217);
             SpawnPlayer(playerid);
        }
        if(listitem == 1)
        {
             SendClientMessage(playerid, ORANGE, "Okay! Landing at Las Ventures Airport");
             SetPlayerInterior(playerid,0);
             SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
             SetPlayerSkin(playerid, 217);
             SpawnPlayer(playerid);
        }
        if(listitem == 2)
        {
             SendClientMessage(playerid, ORANGE, "Okay! Landing at San Fierro Airport");
             SetPlayerInterior(playerid,0);
             SetPlayerPos(playerid, 1683.4304,-2329.0571,13.5469);
             SetPlayerSkin(playerid, 217);
             SpawnPlayer(playerid);
        }
        SendClientMessage(playerid, BLUE, "Thank you For Flying With San Andreas Airlines Have a Nice Day!");
        TogglePlayerControllable(playerid, 1);


    }
    return 1;
}

public SafeGivePlayerWeapon(plyid, weaponid, ammo)
{
    GivePlayerWeapon(plyid, weaponid, ammo);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    TogglePlayerClock(playerid, 0);
    SetPlayerColor(playerid, WHITE );

    MPH[playerid] = TextDrawCreate(10.0,200.0," ");
    TextDrawSetShadow(MPH[playerid],0);
    TextDrawSetOutline(MPH[playerid],1);
    TextDrawFont(MPH[playerid], 2);
    TextDrawShowForPlayer(playerid,MPH[playerid]);
    TextDrawBackgroundColor(MPH[playerid], 255);

    return 1;
}

public speedometer(playerid)
{
    GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]);
    speed1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100;
    speed2[playerid] = floatround(speed1[playerid],floatround_round);
    format(speed3[playerid],256,"%i MPH", speed2[playerid]);
    TextDrawSetString(MPH[playerid], speed3[playerid]);
    return 1;
}

public SafeSetPlayerPos(playerid, Float:x, Float:y, Float:z)
{
    SetPlayerPos(playerid, x,y,z);
    Streamer_UpdateEx(playerid,x,y,z);
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_DRIVER)
    {
        DestroyProgressBar(vhealth[playerid]);
        vhealth[playerid] = INVALID_BAR_ID;
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        vhealth[playerid] = CreateProgressBar(548.5, 36.0, _, _, DARKBLUE, 800.0);
        ShowProgressBarForPlayer(playerid, vhealth[playerid]);
    }
    KillTimer(stimer[playerid]);
    TextDrawSetString(MPH[playerid], " ");
    if(newstate == 2) stimer[playerid] = SetTimerEx("speedometer", 255, true, "i", playerid);
    else if(newstate == 3) stimer[playerid] = SetTimerEx("speedometer", 250, true, "i", playerid);
    return 1;
}

public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws
{
    for(new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid)
    {
        new vehicleid;
        if((vehicleid = GetPlayerVehicleID(playerid)) && vhealth[playerid] != INVALID_BAR_ID)
        {
            new Float:health;
            GetVehicleHealth(vehicleid, health);
            SetProgressBarValue(vhealth[playerid], health);
            UpdateProgressBar(vhealth[playerid], playerid);
        }
    }
}

public VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z)
{
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
        return 0;
}

public HealthDown()
{
    new i,v,p;
    for(i = 0; i<MaxFire; i++)
    {
        if(IsValidFire(i))
        {
            for(p = 0; p<MAX_PLAYERS; p++)
            {
                if(IsPlayerInRangeOfPoint(p, 1, FirePos[i][0], FirePos[i][1], FirePos[i][2]) && !IsPlayerInAnyVehicle(p))
                {
                    new Float:HP;
                    GetPlayerHealth(p, HP);
                    SetPlayerHealth(p, HP-4);
                }
            }
            for(v = 0; v<MAX_VEHICLES; v++)
            {
                if(VehicleToPoint(2, v, FirePos[i][0], FirePos[i][1], FirePos[i][2]))
                {
                    new Float:HP;
                    GetVehicleHealth(v, HP);
                    SetVehicleHealth(v, HP-30);
                }
            }
        }
    }
}

//==============================Stocks==========================================


stock PlayerFaces(playerid, Float:x, Float:y, Float:z, Float:radius)
{
        new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
        GetPlayerCameraPos(playerid, cx, cy, cz);
        GetPlayerCameraFrontVector(playerid, fx, fy, fz);
        return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}

stock AddFire(Float:x, Float:y, Float:z, Health)
{
    TotalFires++;
    new ID = TotalFires;
    FireObj[ID] = CreateObject(3461, x, y, z-2.61, 0, 0, 0.0);
    FirePos[ID][0] = x, FirePos[ID][1] = y, FirePos[ID][2] = z;
    FireHealth[ID] = Health;
    FireHealthMax[ID] = Health;
    new string[128];
    format(string, sizeof(string), "%d/%d", FireHealth[ID], FireHealthMax[ID]);
    FireText[ID] = Create3DTextLabel(string, 0xFFFFFFFFF, x, y, z, 20, 0);
}

stock DeleteFire(ID)
{
    DestroyObject(FireObj[ID]);
    TotalFires--;
    FirePos[ID][0] = 0, FirePos[ID][1] = 0, FirePos[ID][2] = 0;
    Delete3DTextLabel(FireText[ID]);
}

stock DeleteAllFire()
{
    new ID;
    for(ID = 0; ID<MaxFire; ID++)
    {
        DestroyObject(FireObj[ID]);
        TotalFires= 0;
        FirePos[ID][0] = 0, FirePos[ID][1] = 0, FirePos[ID][2] = 0;
        Delete3DTextLabel(FireText[i]);
    }
}

stock IsValidFire(ID)
{
    if( (FirePos[ID][0] != 0) && (FirePos[ID][1] != 0) && (FirePos[ID][2] != 0) ) return true;
    else return false;
}

stock GetClosestFire(playerid)
{
    new i;
    for(i = 0; i<MaxFire; i++)
    {
        if(IsValidFire(i) && IsPlayerInRangeOfPoint(playerid, 1, FirePos[i][0],  FirePos[i][1],  FirePos[i][2]))
        {
            return i;
        }
    }
    return 0;
}

stock GetPlayer2DZone(playerid, zone[], len)
{
    new Float:x22, Float:y22, Float:z22;
    GetPlayerPos(playerid, x22, y22, z22);
    for(new i = 0; i != sizeof(gSANZones); i++ )
    {
        if(x22 >= gSANZones[i][SAZONE_AREA][0] && x22 <= gSANZones[i][SAZONE_AREA][3] && y22 >= gSANZones[i][SAZONE_AREA][1] && y22 <= gSANZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSANZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}

stock GetPlayer2DRadarZone(playerid, zone[], len)
{
    new Float:x22, Float:y22, Float:z22;
    GetPlayerPos(playerid, x22, y22, z22);
    for(new i = 0; i != sizeof(gSAZones); i++ )
    {
        if(x22 >= gSAZones[i][SAZONE_AREA][0] && x22 <= gSAZones[i][SAZONE_AREA][3] && y22 >= gSAZones[i][SAZONE_AREA][1] && y22 <= gSAZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}

stock GetVehicle2DZone(vehicleid, zone[], len)
{
    new Float:x22, Float:y22, Float:z22;
    GetVehiclePos(vehicleid, x22, y22, z22);
    for(new i = 0; i != sizeof(gSANZones); i++ )
    {
        if(x22 >= gSANZones[i][SAZONE_AREA][0] && x22 <= gSANZones[i][SAZONE_AREA][3] && y22 >= gSANZones[i][SAZONE_AREA][1] && y22 <= gSANZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSANZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}

stock GetPlayer3DZone(playerid, zone[], len)
{
    new Float:x33, Float:y33, Float:z33;
    GetPlayerPos(playerid, x33, y33, z33);
    for(new i = 0; i != sizeof(gSAZones); i++ )
    {
        if(x33 >= gSAZones[i][SANZONE_AREA][0] && x33 <= gSAZones[i][SANZONE_AREA][3] && y33 >= gSANZones[i][SAZONE_AREA][1] && y33 <= gSANZones[i][SAZONE_AREA][4] && z33 >= gSAZones[i][SANZONE_AREA][2] && z33 <= gSANZones[i][SAZONE_AREA][5])
        {
            return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}


stock IsPlayerInZone(playerid, zone[])
{
    new TmpZone[MAX_ZONE_NAME];
    GetPlayer3DZone(playerid, TmpZone, sizeof(TmpZone));
    for(new i = 0; i != sizeof(gSANZones); i++)
    {
        if(strfind(TmpZone, zone, true) != -1)
            return 1;
    }
    return 0;
}

stock GetHouse2DZone(houseid, zone[], len)
{
    new Float:x22, Float:y22
    x22 = HouseInfo[houseid][hEntrancex]; y22 = HouseInfo[houseid][hEntrancey];
    for(new i = 0; i != sizeof(gSAZones); i++ )
    {
        if(x22 >= gSAZones[i][SAZONE_AREA][0] && x22 <= gSAZones[i][SAZONE_AREA][3] && y22 >= gSAZones[i][SAZONE_AREA][1] && y22 <= gSAZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}

stock GetHouse2DZone2(houseid, zone[], len)
{
    new Float:x22, Float:y22
    x22 = HouseInfo[houseid][hEntrancex]; y22 = HouseInfo[houseid][hEntrancey];
    for(new i = 0; i != sizeof(gSANZones); i++ )
    {
        if(x22 >= gSANZones[i][SAZONE_AREA][0] && x22 <= gSANZones[i][SAZONE_AREA][3] && y22 >= gSANZones[i][SAZONE_AREA][1] && y22 <= gSANZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSANZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

stock ClearChat(playerid)
{
    for (new a = 0; a < 150; a++)
    {
        SendClientMessage(playerid, WHITE, "        ");
    }
}

stock ClearChatForAll()
{
    for (new b = 0; b < 150; b++)
    {
        SendClientMessageToAll(WHITE, "        ");
    }
}
im guessing first name & lastname dont save either but do what i did to gender to fix it
hope this helps
Reply
#6

Thanks I didnt add anything for first and last Thats yet to come just i couldnt get it to save the age and gender thanks
Reply
#7

well fyi when you do at the top of ya script change
pawn Код:
enum pInfo
{
    pAccount,
    pFirstname,
    pLastname,
    pAge,
    pGender[10],
    pChar,
    pAdminLevel,
    pCash,
    pScore,
    pReg,
    pId,
    pHealth,
    pArmour,
}
to
pawn Код:
enum pInfo
{
    pAccount,
    pFirstname[MAX_PLAYER_NAME],
    pLastname[MAX_PLAYER_NAME],
    pAge,
    pGender[10],
    pChar,
    pAdminLevel,
    pCash,
    pScore,
    pReg,
    pId,
    pHealth,
    pArmour,
}
good luck
Reply
#8

Well age Saves But gender dont in my ini it shows Gender=
Then when i exit the Game it sets gender=0
Reply
#9

replace it with this
pawn Код:
public GenderSection(playerid, Gender[])
{
    new name[MAX_PLAYER_NAME], file[256], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    copy(PlayerInfo[playerid][pGender],Gender,sizeof(Gender));
    dini_Set(file, "Gender",PlayerInfo[playerid][pGender]);

    return 1;
}
Reply
#10

[Resolved] = Thanks for the replys
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)