• 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] how to save last player position and load it
#1
This is my code

#include <a_samp>
#include <YSI\y_ini>

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4

#define PATH "/Users/%s.ini"

#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_GREEN 0x00FF00AA // Bright Green
#define COLOR_PURBLE 0xFF00FFAA // Bright Purple
#define COLOR_RED 0xFF0000AA // Bright Red
#define COLOR_YELLOW 0xFFFF00AA // Bright Yellow
#define COLOR_WHITE  0xFFFFFFAA // Bright White
#define COLOR_BLUE 0x0000FFAA // Bright Blue
#define COLOR_YELLOW12 0xFFCC00AA // Bright1 Yellow
#define COLOR_RED12 0x993333AA // Dark Red

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pBanned,
    pScore,
    pSkin

}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
      s1 = (s1 + buf[n]) % 65521;
      s2 = (s2 + s1)    % 65521;
    }
    return (s2 << 16) + s1;
}

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

new MyPickup;
new mpickup;
new Ypickup;
new Ppickup;
new gangzone;
new Pickup;
new pmpickup;
new Ywpickup;
new Pwpickup;

public OnGameModeInit()
{
SetGameModeText("Arab Server RolePlay");
AddStaticVehicle(602,171.3684,-1341.5986,69.4603,181.6194,16,16);
    AddStaticVehicle(602,171.3651,-1341.4718,69.4798,181.6953,16,16);
    AddStaticVehicle(412,2485.1729,-1682.8943,13.1706,268.5867,16,16);
    AddStaticVehicle(412,2475.4126,-1654.2457,13.2342,89.3399,16,16);
    AddStaticVehicle(412,2504.4441,-1679.4713,13.2944,314.2906,16,16);
    AddStaticVehicle(567,2501.0874,-1655.9918,13.2977,76.7459,16,16);
    AddStaticVehicle(492,2508.8794,-1668.1731,13.2151,359.3311,59,49);
    AddStaticVehicle(492,2494.3245,-1683.0123,13.1699,270.8655,16,1);
    AddStaticVehicle(600,2473.3772,-1700.0703,13.2396,0.4215,84,84);
    AddStaticVehicle(466,2052.7014,-1694.6176,13.2965,270.1249,2,1);
    AddStaticVehicle(429,2040.0538,1341.7698,10.3531,177.8749,2,1);
AddStaticVehicle(468,2060.4963,-1697.7598,13.2156,267.8487,6,6);
AddStaticVehicle(436,2095.9963,-1793.6426,13.1579,269.1816,109,1);
    AddStaticVehicle(410,2095.5249,-1813.4596,13.0381,270.9669,36,1);
    AddStaticVehicle(401,2095.3914,-1820.5477,13.1623,270.2890,87,87);
    AddStaticVehicle(566,2096.0100,-1800.9500,13.1646,268.6882,83,1);
    AddStaticVehicle(419,2096.0693,-1797.1627,13.1833,269.6762,54,75);
    AddStaticVehicle(404,2095.7263,-1816.6825,13.1161,270.8902,101,101);
    AddStaticVehicle(448,2107.2617,-1823.7445,13.1430,86.6142,3,6);
    AddStaticVehicle(448,2107.3750,-1825.5007,13.1519,89.1904,3,6);
    AddStaticVehicle(448,2107.5576,-1827.4673,13.1579,89.2251,3,6);
    AddStaticVehicle(448,2107.4771,-1829.3331,13.1525,90.5329,3,6);
    AddStaticVehicle(448,2110.7417,-1823.8430,13.1537,91.9498,3,6);
    AddStaticVehicle(439,2120.7925,-1781.2820,13.2848,177.9601,57,8);
    AddStaticVehicle(422,2114.8726,-1781.2991,13.3746,180.4383,67,59);
    AddStaticVehicle(418,2109.2576,-1781.2383,13.4816,180.6470,117,227);
    AddStaticVehicle(600,2103.5266,-1781.2870,13.1049,183.4780,8,90);
    AddStaticVehicle(565,1561.0614,-2263.8835,13.1695,268.6060,42,42);
    AddStaticVehicle(547,1560.7764,-2257.5784,13.2828,269.8505,24,1);
    AddStaticVehicle(540,1560.4236,-2247.6511,13.4079,271.1082,7,7);
    AddStaticVehicle(529,1560.3702,-2237.8745,13.1794,270.4413,7,7);
    AddStaticVehicle(527,1560.2473,-2234.5615,13.2621,268.7422,76,1);
    AddStaticVehicle(491,1560.7667,-2322.1882,13.3052,269.5280,64,72);
    AddStaticVehicle(480,1560.4482,-2325.4277,13.3214,271.3584,4,4);
    AddStaticVehicle(479,1560.8082,-2328.6448,13.3425,269.4208,54,31);
    AddStaticVehicle(477,1560.7823,-2331.8130,13.3033,270.4435,121,1);
    AddStaticVehicle(415,1515.0814,-2361.1309,13.3230,0.3779,92,1);
    AddStaticVehicle(412,1508.8453,-2360.7954,13.3888,1.4082,37,8);
    AddStaticVehicle(587,1536.4629,-2212.1897,13.2809,179.6536,95,1);
    AddStaticVehicle(580,1529.9949,-2211.7971,13.3508,178.5321,51,51);
    AddStaticVehicle(579,1526.2854,-2212.3406,13.4898,179.7526,11,11);
    AddStaticVehicle(576,1521.6539,-2212.0552,13.1645,180.8194,76,8);
    AddStaticVehicle(565,1508.7373,-2211.1763,13.1762,180.4353,10,10);
    AddStaticVehicle(562,1505.8075,-2211.3591,13.2127,180.4333,113,1);
    AddStaticVehicle(561,1502.4153,-2212.0520,13.3630,181.2458,67,8);
    AddStaticVehicle(558,1492.6235,-2211.9351,13.1769,179.1212,35,1);
    AddStaticVehicle(596,1602.4037,-1630.6444,13.2149,88.1971,0,1);
    AddStaticVehicle(596,1602.3654,-1626.6801,13.2130,88.6134,0,1);
    AddStaticVehicle(596,1602.3800,-1622.4067,13.2124,89.5686,0,1);
    AddStaticVehicle(596,1602.1331,-1614.6514,13.2085,92.0910,0,1);
    AddStaticVehicle(596,1602.1903,-1610.6451,13.2097,90.4010,0,1);
    AddStaticVehicle(596,1602.0605,-1606.0662,13.2064,90.8565,0,1);
    AddStaticVehicle(601,1544.8877,-1651.1127,5.6494,270.4674,1,1);
    AddStaticVehicle(601,1545.4059,-1659.1665,5.6494,267.6780,1,1);
    AddStaticVehicle(427,1591.0256,-1710.8715,6.0224,179.3453,0,1);
    AddStaticVehicle(427,1587.7485,-1711.0900,6.0225,180.8540,0,1);
    AddStaticVehicle(490,1529.2888,-1684.0226,6.0194,267.8174,0,0);
    AddStaticVehicle(490,1544.4529,-1667.7072,6.0198,271.0140,0,0);
    AddStaticVehicle(490,1544.6797,-1675.9882,6.0182,269.9643,0,0);
    AddStaticVehicle(490,1545.0664,-1684.6477,6.0201,270.7689,0,0);
    AddStaticVehicle(528,1538.7209,-1645.5785,5.9355,180.8854,0,0);
    AddStaticVehicle(528,1530.5789,-1645.4294,5.9343,179.9176,0,0);
    AddStaticVehicle(596,1601.5591,-1684.0519,5.6123,89.5858,0,1);
    AddStaticVehicle(596,1601.5209,-1688.3495,5.6117,90.1611,0,1);
    AddStaticVehicle(596,1601.6317,-1695.9609,5.6115,89.7080,0,1);
    AddStaticVehicle(596,1585.5900,-1667.6532,5.6132,270.8575,0,1);
    AddStaticVehicle(427,1578.9691,-1711.2435,6.0226,180.4949,0,1);
    AddStaticVehicle(427,1570.1755,-1711.4225,6.0225,182.1094,0,1);
    AddStaticVehicle(427,1562.6941,-1710.8721,6.0225,181.0773,0,1);
    AddStaticVehicle(523,1592.7800,-1605.5839,12.9531,181.2934,0,0);
    AddStaticVehicle(523,1589.8721,-1605.8724,12.9553,177.3770,0,0);
    AddStaticVehicle(523,1587.3577,-1605.9468,12.9542,177.5560,0,0);
    AddStaticVehicle(523,1585.0715,-1606.0339,12.9551,178.8215,0,0);
    AddStaticVehicle(412,2217.8711,-1157.5225,25.5641,271.5001,16,16);
    AddStaticVehicle(492,2217.9231,-1162.2678,25.5083,267.1677,16,1);
    AddStaticVehicle(492,2217.1863,-1170.3641,25.5082,271.2394,16,1);
    AddStaticVehicle(567,2217.0396,-1165.9182,25.5952,273.4421,16,16);
    AddStaticVehicle(492,2205.9509,-1157.2190,25.5173,87.5250,16,1);
    AddStaticVehicle(492,2206.4526,-1173.3522,25.5082,89.2638,16,1);
    AddStaticVehicle(474,2334.3105,-1159.2070,26.6788,264.8321,6,6);
    AddStaticVehicle(467,2342.6963,-1158.7308,26.8469,270.9521,6,6);
    AddStaticVehicle(467,2365.9050,-1166.8635,27.2509,177.0255,6,6);
    AddStaticVehicle(474,2356.0049,-1159.3859,27.1763,269.7199,6,6);
    AddStaticVehicle(517,1943.6993,-1130.9857,25.3424,94.8128,126,1);
    AddStaticVehicle(517,1922.0658,-1130.4795,24.7992,93.0231,126,1);
    AddStaticVehicle(566,1932.5033,-1130.4945,24.9852,92.5352,126,126);
    AddStaticVehicle(566,1889.1613,-1131.4417,23.8983,85.9013,126,126);
    AddStaticVehicle(566,1908.0199,-1130.5533,24.3764,92.1271,126,126);
    AddStaticVehicle(567,2493.6123,-1753.0233,13.3537,1.1509,16,16);
    AddStaticVehicle(492,2501.3708,-1752.9397,13.2024,359.6364,16,1);
    AddStaticVehicle(492,2477.0398,-1751.1873,13.3287,359.6566,16,1);
    AddStaticVehicle(458,2483.5359,-1751.8325,13.4253,358.3758,84,84);
    AddStaticVehicle(502,2657.5845,-1697.0990,9.2086,271.2960,75,61);
    AddStaticVehicle(503,2658.3401,-1706.6307,9.2155,269.1581,117,116);
    AddStaticVehicle(494,2658.2307,-1701.7738,9.2155,267.7059,54,36);
    AddStaticVehicle(495,2657.8330,-1692.0654,9.6624,270.2106,123,124);
    AddStaticVehicle(495,2658.2783,-1711.7072,9.6706,269.6668,114,108);
    AddStaticVehicle(556,2676.5583,-1672.4496,9.7722,179.4838,1,1);
    AddStaticVehicle(557,2681.7646,-1672.8662,9.7979,179.5465,1,1);
    AddStaticVehicle(556,2686.5015,-1672.6355,9.8191,178.7388,1,1);
    AddStaticVehicle(556,2697.1199,-1672.7297,9.8626,181.7495,1,1);
    AddStaticVehicle(557,2691.7493,-1671.9313,9.8397,179.9664,1,1);
    CreateActor(102,1941.1543,-1117.9009,26.4455,180.4904);
    CreateActor(103,1938.1199,-1117.5718,26.4455,177.0437);
    CreateActor(107,2521.0461,-1680.7599,14.8811,84.8293);
    CreateActor(105,2519.7476,-1677.2390,14.5793,87.9393);
CreateActor(280,1578.7549,-1634.1285,13.5624,355.0591);
CreateActor(280,1580.6666,-1634.1276,13.5622,355.0591);
CreateActor(106,2450.3164,-1998.7609,13.5469,180.8690);
CreateActor(107,2456.5471,-1999.3121,13.5469,172.4089);
CreateActor(6,2440.9526,-1962.9823,13.5469,174.6162);
MyPickup = CreatePickup(1314,23,2503.8677,-1685.4696,13,-1);
mpickup = CreatePickup(1314,23,1933.3479,-1119.0906,26,-1);
Ypickup = CreatePickup(1314,23,2351.7708,-1165.2024,27,-1);
Ppickup = CreatePickup(1314,23,239.0411,75.8130,1005,-1);
gangzone = GangZoneCreate(2517.5217, -1661.9059, 2339.8516, -1729.4061);
Pickup = CreatePickup(348,2,2508.4104,-1684.2233,13,-1);
Pickup = CreatePickup(352,2,2510.6182,-1682.1265,13,-1);
Pickup = CreatePickup(356,2,2512.4165,-1679.9208,13,-1);
pmpickup = CreatePickup(348,2,1944.2538,-1118.6057,26,-1);
pmpickup = CreatePickup(352,2,1943.9448,-1120.4343,26,-1);
pmpickup = CreatePickup(356,2,1943.6592,-1122.4967,26,-1);
Ywpickup = CreatePickup(348,2,2363.4873,-1164.7046,27,-1);
Ywpickup = CreatePickup(352,2,2363.2622,-1166.7206,27,-1);
Ywpickup = CreatePickup(356,2,2363.6135,-1169.6571,27,-1);
Pwpickup = CreatePickup(346,2,1544.3092,-1631.8982,13,-1);
Pwpickup = CreatePickup(346,2,218.7476,81.0516,1005,-1);
Pwpickup = CreatePickup(334,2,218.2496,78.3512,1005,-1);
Pwpickup = CreatePickup(1242,2,253.0681,80.1647,1003,-1);
Pwpickup = CreatePickup(321,2,261.5091,70.9910,1003,-1);
SetTimer("Time", 3600000, true);
UsePlayerPedAnims();
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    SetPlayerMapIcon(playerid, 12, 2503.4673,-1685.1571,13.5469, 62, 0, MAPICON_GLOBAL);
    SetPlayerMapIcon(playerid, 13, 1933.3635,-1119.1494,26.4531, 59, 0, MAPICON_GLOBAL);
    SetPlayerMapIcon(playerid, 14, 2351.7708,-1165.2024,27.4378, 60, 0, MAPICON_GLOBAL);
    SetPlayerMapIcon(playerid, 15, 1685.7391,-2244.6516,13.5469, 5, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 16, 1929.8866,-1776.8219,13.5469, 55, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 17, 2102.7031,-1806.7620,13.5547, 29, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 19, 2131.6760,-1150.7050,24.1264, 55, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 20, 2062.5820,-1831.8528,13.5469, 63, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 21, 2072.8892,-1794.0254,13.5469, 7, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 22, 2070.5742,-1779.5708,13.5587, 39, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 23, 2244.8904,-1663.4241,15.4766, 45, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 24, 2228.6997,-1722.4965,13.5552, 54, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 25, 1553.1901,-1674.7737,16.1953, 30, 0, MAPICON_GLOBAL);
    GivePlayerMoney(playerid,1000);
    SetPlayerMapIcon(playerid, 26, 1365.3500,-1279.0601,13.5469, 6, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 33, 2033.3813,-1404.0724,17.2686, 22, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 34, 1174.5277,-1324.0151,14.7891, 22, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 35, 1756.3395,-1464.2751,13.5469, 20, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 36, 2404.5330,-1905.7328,13.5469, 14, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 37, 2419.8440,-1500.4395,24.0000, 14, 0, MAPICON_LOCAL);
    SetPlayerMapIcon(playerid, 39, 2308.1980,-1645.9747,14.8270, 49, 0, MAPICON_LOCAL);
    GangZoneShowForAll(gangzone,COLOR_GREEN);
    if(PlayerInfo[playerid][pAdmin] > 6)
    {
    SendClientMessageToAll(COLOR_RED, "Owner has joined the server");
    AddPlayerClass(165,1685.5206,-2242.7856,13.5469,172.8506,0,0,0,0,0,0);
    SetPlayerColor(playerid,COLOR_RED12);
    SendClientMessage(playerid, COLOR_YELLOW, "Welcome to your server master :D");
    }
    else
    {
    if(PlayerInfo[playerid][pAdmin] < 0)
    AddPlayerClass(2,1685.5206,-2242.7856,13.5469,172.8506,0,0,0,0,0,0);
    SetPlayerColor(playerid,COLOR_WHITE);
    }
    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_Close(File);
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}

public OnPlayerSpawn(playerid)
{
  SendClientMessage(playerid, COLOR_RED, "You have got $1000 from the server have fun :D");
  return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    PlayerInfo[killerid][pScore]++;
    SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed
    GivePlayerMoney(killerid, 1000);
    SendClientMessage(killerid, COLOR_RED, "You have been awarded $1000 for the kill.");
    if(killerid != INVALID_PLAYER_ID)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 10) == 0)
{
        SendClientMessage(playerid, COLOR_RED, "Hello Player!");
        SendClientMessage(playerid, COLOR_RED, "<<<<<<<<<<<Jobs>>>>>>>>>>>");
SendClientMessage(playerid, COLOR_RED, "1- Go to Gangs icons in the map to join the Gang!");
SendClientMessage(playerid, COLOR_RED, "2- Go to the Police icon in map to be Police Officer!");
SendClientMessage(playerid, COLOR_RED, "<<<<<<<<<<<Commands>>>>>>>>>>>");
SendClientMessage(playerid, COLOR_RED, "1- Type /Score to see your Score!");
SendClientMessage(playerid, COLOR_RED, "2- Type /Heal to Heal yourself(Owner only who can use this command)!");
SendClientMessage(playerid, COLOR_RED, "3- Type /Armour to Armour yourself(Owner only who can use this command)!");
SendClientMessage(playerid, COLOR_RED, "4- Type /Giveall to Give all the players and admins money(Owner only who can use this command)!");
return 1;
}
if(!strcmp(cmdtext,"/score",true))
    {
        new string[128];
        format(string, sizeof(string), "Score: %i",GetPlayerScore(playerid));
        SendClientMessage(playerid, COLOR_YELLOW, string);
        return 1;
    }
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
    if(PlayerInfo[playerid][pAdmin] > 6)
    {
    SendClientMessage(playerid, COLOR_RED, "You have been healed");
    SetPlayerHealth(playerid,100);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "You arenot owner");
    }
  }
    if (strcmp("/armour", cmdtext, true, 10) == 0)
    {
    if(PlayerInfo[playerid][pAdmin] > 6)
    {
    SendClientMessage(playerid, COLOR_RED, "You have been Armoured");
    SetPlayerArmour(playerid,100);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "You arenot owner");
    }
  }
    if (strcmp("/giveall", cmdtext, true, 10) == 0)
    {
    if(PlayerInfo[playerid][pAdmin] > 6)
    {
    SendClientMessageToAll(COLOR_GREEN, "The owner gave you all the money");
    GivePlayerMoney(playerid,10000);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "You arenot owner");
}
}
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

forward PingCheckTimer(playerid);
public PingCheckTimer(playerid)
{
    // Kick players with a high ping
    if(GetPlayerPing(playerid) > 1000) Kick(playerid);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == MyPickup){
SendClientMessage(playerid, COLOR_GREEN, "You in Grove Street now!");
SendClientMessage(playerid, COLOR_RED, "Kill the other Gangs and take Zones from them!");
SetPlayerColor(playerid, COLOR_GREEN);
SetPlayerSkin(playerid,106);
SetPlayerMapIcon(playerid, 18, 2231.0247,-1159.5146,25.8290, 23, 0, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_RED, "You can go to your Gang Base and do Missions now and you can go to take Weapons from Emmet!");
SetPlayerMapIcon(playerid, 27, 2451.3232,-1972.7374,13.5539, 18, 0, MAPICON_GLOBAL);
SetPlayerMapIcon(playerid, 28, 2522.8523,-1679.1565,15.4970, 38, 0, MAPICON_GLOBAL);
SetPlayerMapIcon(playerid, 29, 2459.6348,-1691.6274,13.5431, 34, 0, MAPICON_GLOBAL);
SetPlayerMapIcon(playerid, 30, 2072.7100,-1703.2107,13.5547, 8, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,31);
RemovePlayerMapIcon(playerid,32);
RemovePlayerMapIcon(playerid,38);
RemovePlayerMapIcon(playerid,40);
}
if(pickupid == mpickup){
    SendClientMessage(playerid, COLOR_PURBLE, "You in Ballas now!");
SendClientMessage(playerid, COLOR_RED, "Kill the other Gangs and take Zones from them!");
SendClientMessage(playerid, COLOR_RED, "You can go to your Gang Base and do Missions now!");
SetPlayerColor(playerid, COLOR_PURBLE);
SetPlayerSkin(playerid,102);
RemovePlayerMapIcon(playerid,18);
RemovePlayerMapIcon(playerid,27);
RemovePlayerMapIcon(playerid,28);
RemovePlayerMapIcon(playerid,29);
SetPlayerMapIcon(playerid, 29, 2459.6348,-1691.6274,13.5431, 34, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,30);
SetPlayerMapIcon(playerid, 30, 2072.7100,-1703.2107,13.5547, 8, 0, MAPICON_GLOBAL);
SetPlayerMapIcon(playerid, 31, 2167.5359,-1672.8494,15.0810, 23, 0, MAPICON_GLOBAL);
SetPlayerMapIcon(playerid, 32, 2521.1733,-1272.7887,34.8918, 23, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,38);
SetPlayerMapIcon(playerid, 40, 1611.9530,-1891.9105,13.5469, 23, 0, MAPICON_GLOBAL);
    }
    if(pickupid == Ypickup){
    SendClientMessage(playerid, COLOR_YELLOW, "You in Vagos now!");
SendClientMessage(playerid, COLOR_RED, "Kill the other Gangs and take Zones from them!");
SendClientMessage(playerid, COLOR_RED, "You can go to your Gang Base!");
SetPlayerColor(playerid, COLOR_YELLOW);
SetPlayerSkin(playerid,110);
RemovePlayerMapIcon(playerid,18);
RemovePlayerMapIcon(playerid,27);
RemovePlayerMapIcon(playerid,28);
RemovePlayerMapIcon(playerid,29);
RemovePlayerMapIcon(playerid,30);
RemovePlayerMapIcon(playerid,31);
RemovePlayerMapIcon(playerid,32);
SetPlayerMapIcon(playerid, 38, 2520.2327,-1272.9634,34.8837, 23, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,40);
}
if(pickupid == Ppickup){
    SendClientMessage(playerid, COLOR_BLUE, "You in Police now!");
SendClientMessage(playerid, COLOR_RED, "Arrest the criminals and gangsters who have stars as you can be a corrupt cop by doing missions Tenpenny or Big Smoke or Ryder !");
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerSkin(playerid,284);
RemovePlayerMapIcon(playerid,18);
RemovePlayerMapIcon(playerid,27);
RemovePlayerMapIcon(playerid,28);
RemovePlayerMapIcon(playerid,29);
SetPlayerMapIcon(playerid, 29, 2459.6348,-1691.6274,13.5431, 34, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,30);
SetPlayerMapIcon(playerid, 30, 2072.7100,-1703.2107,13.5547, 8, 0, MAPICON_GLOBAL);
RemovePlayerMapIcon(playerid,31);
RemovePlayerMapIcon(playerid,32);
RemovePlayerMapIcon(playerid,38);
RemovePlayerMapIcon(playerid,40);
}
if(pickupid == Pickup){
GivePlayerWeapon(playerid,348,500);
GivePlayerWeapon(playerid,352,500);
GivePlayerWeapon(playerid,356,500);
SendClientMessage(playerid, COLOR_GREEN, "The Weapons will respawn after 30 Sec!");
}
if(pickupid == pmpickup){
GivePlayerWeapon(playerid,348,500);
GivePlayerWeapon(playerid,352,500);
GivePlayerWeapon(playerid,356,500);
SendClientMessage(playerid, COLOR_PURBLE, "The Weapons will respawn after 30 Sec!");
}
if(pickupid == Ywpickup){
GivePlayerWeapon(playerid,348,500);
GivePlayerWeapon(playerid,352,500);
GivePlayerWeapon(playerid,356,500);
SendClientMessage(playerid, COLOR_YELLOW, "The Weapons will respawn after 30 Sec!");
}
if(pickupid == Pwpickup){
GivePlayerWeapon(playerid,346,500);
GivePlayerWeapon(playerid,346,500);
GivePlayerWeapon(playerid,321,1);
GivePlayerWeapon(playerid,334,1);
SetPlayerArmour(playerid,100);
SendClientMessage(playerid, COLOR_BLUE, "The Weapons will respawn after 30 Sec!");
}
return 1;
}

forward Time();
public Time()
{
    new h;
    gettime(h);
    if(h == 18 || h == 19) // here we check if it is 19h or 18h if it is we will set the world time to current time plus 5 hours so it will be night and so we are goin on with this below
    {
        SetWorldTime(h+5);
    }
    else if(h == 20 || h == 21)
    {
        SetWorldTime(h+4);
    }
    else if(h == 22 || h == 23)
    {
        SetWorldTime(h+2);
    }
    else  // here we check if current time is not 18,19,20,21,22,23 (everything that we haven't specified before) and if time is like 9h AM it will set your world time to 9
    {
        SetWorldTime(h);
    }
}
  Reply
#2
what even is this?
  Reply


Forum Jump: