Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Server Includes */
- #include <a_samp>
- #include <streamer>
- #include <zcmd>
- #include <foreach>
- #include <sscanf2>
- #include <YSI\y_ini>
- #include <a_actor>
- #include <fly>
- /* Server Colors */
- #define COLOR_PURPLE 0xC2A2DAAA
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_LIGHTBLUE 0x006FDD96
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_FADE 0xC8C8C8C8
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_YELLOW 0xDABB3E00
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_GRAD6 0xF0F0F0FF
- #define TEAM_HIT_COLOR 0xFFFFFF00
- #define COLOR_RED 0xFF0000FF
- #define COLOR_GREEN 0x90EE90FF
- #define COL_RED "{F81414}"
- #define COL_WHITE "{FFFFFF}"
- /* Server Defines */
- #define PATH "Accounts/%s.ini"
- #define SECONDS(%1) ((%1)*(1000))
- #define ALTCOMMAND:%1->%2; \
- COMMAND:%1(playerid, params[]) \
- return cmd_%2(playerid, params);
- #define function%0(%1) forward%0(%1); public%0(%1)
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- /* NEWS-URI*/
- new vCar[MAX_PLAYERS] = -1;
- /* SERVER SIDE CASH */
- #define GivePlayerCash(%0,%1) SetPVarInt(%0,"Money",GetPlayerCash(%0)+%1),GivePlayerMoney(%0,%1)
- #define ResetPlayerCash(%0) SetPVarInt(%0,"Money",0), ResetPlayerMoney(%0)
- #define GetPlayerCash(%0) GetPVarInt(%0,"Money")
- /* DIALOGS */
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_AGE 3
- #define DIALOG_SEX 4
- #define DIALOG_WEAPON 5
- #define DIALOG_tplist 6
- /* ENUMS */
- enum pInfo
- {
- pPass,
- pCash,
- pAdmin,
- pSex,
- pAge,
- Float:pPos_x,
- Float:pPos_y,
- Float:pPos_z,
- pSkin,
- pTeam,
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- /* <--------------------------------------------> */
- main()
- {
- print(" ");
- print(" ");
- print("- CONNECTED TO SERVER -");
- print(" ");
- }
- new
- noooc = 0,
- Logged[ MAX_PLAYERS ],
- gOoc[ MAX_PLAYERS ]
- ;
- public OnPlayerConnect(playerid)
- {
- InitFly(playerid);
- gOoc[ playerid ] = 0; Logged[ playerid ] = 0;
- // Reset stats!
- PlayerInfo[ playerid ][ pCash ] = 0;
- PlayerInfo[ playerid ][ pAdmin ] = 0;
- PlayerInfo[ playerid ][ pSex ] = 0;
- PlayerInfo[ playerid ][ pAge ] = 0;
- PlayerInfo[ playerid ][ pPos_x ] = 0.0;
- PlayerInfo[ playerid ][ pPos_y ] = 0.0;
- PlayerInfo[ playerid ][ pPos_z ] = 0.0;
- PlayerInfo[ playerid ][ pSkin ] = 0;
- PlayerInfo[ playerid ][ pTeam ] = 0;
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"LOGIN","Type your password below to login:","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"REGISTER","Type your password below to register a new account:","Register","Quit");
- }
- return 1;
- }
- //================================================================//
- public OnPlayerRequestClass(playerid, classid)
- {
- SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
- TogglePlayerSpectating(playerid, 1);
- SpawnPlayer(playerid);
- SetTimerEx("SkipOnPlayerRequestClass", 100, false, "i", playerid);
- return 1;
- }
- forward SkipOnPlayerRequestClass(playerid);
- public SkipOnPlayerRequestClass(playerid)
- {
- SpawnPlayer(playerid);
- TogglePlayerSpectating(playerid, 0);
- return 1;
- }
- public OnGameModeInit()
- {
- /* <-------------------------------------------> */
- AddPlayerClass(233,1243.9525,-317.7200,9.3428,197.2483,0,0,0,0,0,0);
- AddPlayerClass(233,1243.9525,-317.7200,9.3428,197.2483,0,0,0,0,0,0);
- AddStaticVehicle(411,1835.8517,-1866.5050,13.3828,338.0116,211,226); // infernus #1
- /* <-------------------------------------------> */
- ShowPlayerMarkers(0);
- ShowNameTags(1);
- DisableInteriorEnterExits();
- EnableStuntBonusForAll(0);
- SetNameTagDrawDistance(30.0);
- UsePlayerPedAnims();
- // =========== TIMERS ===========
- SetTimer("MoneyUpdate",1000,1);
- SetTimer("SaveAccounts", SECONDS(13), 1);
- return 1;
- }
- //================================================================//
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
- SetPlayerToTeamColor(playerid);
- Logged[playerid] = 1;
- }
- if(PlayerInfo[playerid][pPos_x] == 0 && PlayerInfo[playerid][pPos_y] == 0)
- {
- SetPlayerPos(playerid,1799.8875,-1866.1479,13.5718);
- SetPlayerFacingAngle( playerid,359.7014);
- Logged[playerid] = 1;
- }
- else
- {
- SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
- Logged[playerid] = 1;
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- GameTextForPlayer(playerid, "Wasted", 5000, 2);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 6)
- {
- if(response) // If they clicked 'Select' or double-clicked a weapon
- {
- switch(listitem)
- {
- case 0: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1462.4116,-1013.3667,26.8438);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Bank LS successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Bank LS!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1462.4116,-1013.3667,26.8438);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Bank LS successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Bank LS!", 3000, 3);
- }
- case 1: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,-2307.9568,-1637.9387,483.6966);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Chilliad successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Chilliad!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,-2307.9568,-1637.9387,483.6966);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Chilliad successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Chilliad!", 3000, 3);
- }
- case 2: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1544.6248,-1675.6541,13.5588);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to LSPD successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ LSPD!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1544.6248,-1675.6541,13.5588);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to LSPD successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ LSPD!", 3000, 3);
- }
- case 3: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1365.5562,-1279.7185,13.5469);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Gun Shop successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Gun Shop!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1365.5562,-1279.7185,13.5469);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Gun Shop successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Gun Shop!", 3000, 3);
- }
- case 4: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1821.9342,-1849.9662,13.4141);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Spawn Civil successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Spawn Civil!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1821.9342,-1849.9662,13.4141);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Spawn Civil successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Spawn Civil!", 3000, 3);
- }
- case 5: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,2084.9773,-2539.1396,13.5532);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Airport Los Santos successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Airport Los Santos!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,2084.9773,-2539.1396,13.5532);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Airport Los Santos successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Airport Los Santos!", 3000, 3);
- }
- case 6: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1128.8594,-1446.3535,15.7969);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to CNN Los Santos successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ CNN Los Santos!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1128.8594,-1446.3535,15.7969);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to CNN Los Santos successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ CNN Los Santos!", 3000, 3);
- }
- case 7: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,345.4262,-1783.5619,5.2552);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to the beach successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ the beach!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,345.4262,-1783.5619,5.2552);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to the beach successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ the beach!", 3000, 3);
- }
- case 8: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,334.6613,-1520.3934,35.8672);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to DealerShip successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ DealerShip!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,334.6613,-1520.3934,35.8672);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to DealerShip successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ DealerShip!", 3000, 3);
- }
- case 9: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,714.2040,-537.2700,16.3359);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Dillimore successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Dillimore!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,714.2040,-537.2700,16.3359);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Dillimore successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Dillimore!", 3000, 3);
- }
- case 10: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,1434.6615,1701.2008,10.8203);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Airport Las Venturas successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Airport Las Venturas!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,1434.6615,1701.2008,10.8203);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to Airport Las Venturas successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ Airport Las Venturas!", 3000, 3);
- }
- case 11: if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- //set vehicle position if he is in a vehicle
- SetVehiclePos(vehicleid,2087.4399,2035.3589,10.8203);
- //Gametext and client message for the player
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to CNN Las Venturas successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ CNN Las Venturas!", 3000, 3);
- }
- //if the player is on foot
- else
- {
- SetPlayerPos(playerid,2087.4399,2035.3589,10.8203);//set the player position
- SetPlayerInterior(playerid,0);//set the player interior ( so that he wont be bugged if teleported from another interior)eg:teleport from inside the ammunation
- //client message and game text
- SendClientMessage(playerid,COLOR_GREEN,"SERVER: You have been teleported to CNN Las Venturas successfully!");
- GameTextForPlayer(playerid, "~b~Welcome to~r~ CNN Las Venturas!", 3000, 3);
- }
- }
- }
- return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
- }
- if(dialogid == 5)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, WEAPON_DEAGLE, 100);
- case 1: GivePlayerWeapon(playerid, WEAPON_M4, 999);
- case 2: GivePlayerWeapon(playerid, WEAPON_MP5, 999);
- case 3: GivePlayerWeapon(playerid, WEAPON_SNIPER, 100);
- case 4: GivePlayerWeapon(playerid, WEAPON_ROCKETLAUNCHER, 999);
- case 5: GivePlayerWeapon(playerid, WEAPON_TEC9, 999);
- case 6: GivePlayerWeapon(playerid, WEAPON_MINIGUN, 999);
- case 7: GivePlayerWeapon(playerid, WEAPON_FLAMETHROWER, 999);
- case 8: GivePlayerWeapon(playerid, WEAPON_SPRAYCAN, 999);
- case 9: GivePlayerWeapon(playerid, WEAPON_CHAINSAW, 1);
- case 10: GivePlayerWeapon(playerid, WEAPON_SHOTGSPA,999);
- case 11: GivePlayerWeapon(playerid, WEAPON_SAWEDOFF,999);
- case 12: GivePlayerWeapon(playerid, WEAPON_AK47, 999);
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_AGE)
- {
- if(!response)
- {
- Kick(playerid);
- }
- else
- {
- if(strlen(inputtext))
- {
- new age = strval(inputtext);
- if(age > 100 || age < 8)
- {
- ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 8 - 100 ))","Answer","Quit");
- }
- else
- {
- PlayerInfo[playerid][pAge] = age;
- new
- string[ 64 ]
- ;
- format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
- SendClientMessage(playerid, -1, string);
- GivePlayerCash(playerid, 600);
- SaveAccountStats(playerid);
- SpawnPlayer(playerid);
- }
- }
- else
- {
- return 0;
- }
- }
- }
- if(dialogid == DIALOG_SEX)
- {
- if(response)
- {
- PlayerInfo[playerid][pSex] = 1;
- SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
- SetPlayerSkin(playerid, 60);
- PlayerInfo[playerid][pSkin] = 60;
- ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 8 - 100 ))","Answer","Quit");
- }
- else
- {
- PlayerInfo[playerid][pSex] = 2;
- SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
- SetPlayerSkin(playerid, 233);
- PlayerInfo[playerid][pSkin] = 233;
- ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 8 - 100 ))","Answer","Quit");
- }
- }
- switch( dialogid )
- {
- case DIALOG_REGISTER:
- {
- if (!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType 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,"Sex",0);
- INI_WriteInt(File,"Age",0);
- INI_WriteFloat(File,"Pos_x",0);
- INI_WriteFloat(File,"Pos_y",0);
- INI_WriteFloat(File,"Pos_z",0);
- INI_WriteInt(File,"Skin",0);
- INI_WriteInt(File,"Team",0);
- INI_Close(File);
- ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
- }
- }
- 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);
- new
- tmp2[ 256 ],
- playername2[ MAX_PLAYER_NAME ]
- ;
- GetPlayerName(playerid, playername2, sizeof(playername2));
- format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
- GameTextForPlayer(playerid, tmp2, 5000, 1);
- SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
- GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
- SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
- TogglePlayerSpectating(playerid, 0);
- }
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandPerformed(playerid, cmdtext[], success)
- {
- if(success)
- {
- return 1;
- }
- //================================================================//
- if(strcmp(cmdtext,"/jetpack",true) == 0)
- {
- if(PlayerInfo[playerid][pAdmin] >= 1 )
- {
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- SetPlayerPos(playerid, X, Y, Z);
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: You have spawned a jetpack!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //================================================================//
- if(strcmp(cmdtext,"/removejetpack",true) == 0)
- {
- if(PlayerInfo[playerid][pAdmin] >= 1 )
- {
- SetPlayerSpecialAction(playerid,0);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: You have just removed your jetpack!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- return 1;
- }
- //================================================================//
- public OnPlayerText(playerid, text[])
- {
- new pname[24], str[128];
- GetPlayerName(playerid, pname, 24);
- format(str, sizeof(str), "%s:%s.", pname, text);
- ProxDetector(30.0, playerid, str, -1, -1, -1, -1, COLOR_FADE2);
- return 0;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SaveAccountStats(playerid);
- vCar[playerid] = -1;
- return 1;
- }
- //================================================================//
- function SetPlayerToTeamColor(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- SetPlayerColor(playerid,TEAM_HIT_COLOR);
- }
- }
- function OOCOff(color,const string[])
- {
- foreach (Player,i)
- {
- if(!gOoc{i})
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- function SaveAccountStats(playerid)
- {
- if(Logged[playerid] == 1)
- {
- new
- INI:File = INI_Open(UserPath(playerid))
- ;
- INI_SetTag(File,"data");
- PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
- PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
- INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
- INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
- INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
- INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
- INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
- INI_Close(File);
- }
- return 1;
- }
- //================================================================//
- function SaveAccounts()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SaveAccountStats(i);
- }
- }
- }
- function GameModeExitFunc()
- {
- GameModeExit();
- return 1;
- }
- //================================================================//
- function 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("Sex",PlayerInfo[playerid][pSex]);
- INI_Int("Age",PlayerInfo[playerid][pAge]);
- INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
- INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
- INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
- INI_Int("Skin",PlayerInfo[playerid][pSkin]);
- INI_Int("Team",PlayerInfo[playerid][pTeam]);
- return 1;
- }
- function MoneyUpdate(playerid)
- {
- if(GetPlayerCash(playerid) < GetPlayerMoney(playerid))
- {
- foreach(Player, i)
- {
- new const old_money = GetPlayerCash(playerid);
- ResetPlayerCash(playerid), GivePlayerCash(playerid, old_money);
- }
- }
- return 1;
- }
- //================================================================//
- function ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new BigEar[MAX_PLAYERS];
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- if(!BigEar[i])
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- }
- return 1;
- }
- // ============ STOCKS ============
- stock SendAdminMessage( color, string[] )
- {
- foreach (Player,i)
- {
- if( PlayerInfo[ i] [ pAdmin ] > 1 )
- {
- SendClientMessage( i, color, string );
- }
- }
- }
- 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;
- }
- stock RPName(playerid)
- {
- new string[24];
- GetPlayerName(playerid,string,24);
- new str[24];
- strmid(str,string,0,strlen(string),24);
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if (str[i] == '_') str[i] = ' ';
- }
- return str;
- }
- // =================================
- /* LOGS */
- function OOCLog(string[])
- {
- new
- entry[ 128 ],
- year,
- month,
- day,
- hour,
- minute,
- second
- ;
- getdate(year, month, day);
- gettime(hour, minute, second);
- format(entry, sizeof(entry), "%s | (%d-%d-%d) (%d:%d:%d)\n",string, day, month, year, hour, minute, second);
- new File:hFile;
- hFile = fopen("Basic/logs/OOCLog.log", io_append);
- fwrite(hFile, entry);
- fclose(hFile);
- }
- //===========================================///* COMMANDS *///===========================================//
- CMD:stats(playerid, params[])
- {
- if(IsPlayerConnected(playerid))
- {
- new
- string[ 128 ],
- Age = PlayerInfo[ playerid ][ pAge ],
- Money = GetPlayerCash( playerid )
- ;
- new Sex[20];
- if(PlayerInfo[ playerid ][ pSex ] == 1) { Sex = "Male"; }
- else if(PlayerInfo[ playerid ][ pSex ] == 2) { Sex = "Female"; }
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "------------------------------------------------------------------------");
- format(string, sizeof(string), "Name: %s | Money: %d | Age: %d | Sex: %s", RPName(playerid), Money, Age, Sex);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- }
- return 1;
- }
- //===========================================//
- CMD:veh(playerid, params[]) {
- new vehid;
- if(PlayerInfo[playerid][pAdmin] == 6 )
- if(sscanf(params, "i", vehid)) SendClientMessage(playerid, COLOR_RED, "SYNTAX: /veh <carid>");
- else if (vehid < 400 || vehid > 611) SendClientMessage(playerid, COLOR_RED, "[ERROR] Invalid car id! [ Car ID's range from 400 - 611 ]");
- else
- {
- if(vCar[playerid] != -1)
- {
- DestroyVehicle(vCar[playerid]);
- }
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- vCar[playerid] = CreateVehicle(vehid, x, y + 7, z, 0, 0,0, -1);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: Car spawned at your location!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 6 administrator to use this command!");
- }
- return 1;
- }
- #endif
- //===========================================//
- CMD:ahelp(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1,"You are not admin!");
- SendClientMessage(playerid, -1, "____________________________________________________________________");
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 1: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 2)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 2: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 3: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 4)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 4: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 5)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 5: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 6)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 6: No commands yet!");
- }
- if(PlayerInfo[playerid][pAdmin] >= 1337)
- {
- SendClientMessage(playerid, COLOR_FADE, "Level 1337: /givemoney -");
- }
- SendClientMessage(playerid, -1, "____________________________________________________________________");
- return 1;
- }
- //===========================================//
- CMD:help(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_LIGHTBLUE,"------------------------------------------------------------");
- SendClientMessage(playerid, COLOR_GRAD2,"/do - /me");
- SendClientMessage(playerid, COLOR_LIGHTBLUE,"------------------------------------------------------------");
- return 1;
- }
- //===========================================//
- ALTCOMMAND:o->ooc;
- CMD:ooc(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1 )
- {
- new
- string[ 186 ]
- ;
- if((noooc) && PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, "OOC Chat closed by administrator!");
- if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}(/o)oc [ooc chat]");
- format(string, sizeof(string), "(( OOC: %s: %s ))", RPName(playerid), params);
- OOCOff(0xCCFFFF00, string);
- OOCLog(string);
- printf("%s", string);
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //===========================================//
- CMD:b(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1 )
- {
- new
- string[ 128 ]
- ;
- if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF} /b [ooc chat]");
- format(string, sizeof(string), "(( OOC: %s[%i]: %s ))", RPName( playerid ), playerid, params);
- printf("%s", string);
- ProxDetector(30.0, playerid, string, COLOR_FADE,COLOR_FADE,COLOR_FADE,COLOR_FADE,COLOR_FADE);
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //===========================================//
- CMD:do(playerid, params[])
- {
- new
- result[ 128 ],
- string[ 128 ]
- ;
- if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/do [action]");
- format(string, sizeof(string), "* %s (( %s ))", result, RPName(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- printf("%s", string);
- return 1;
- }
- //===========================================//
- CMD:me(playerid, params[])
- {
- new
- result[ 128 ],
- string[ 128 ]
- ;
- if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/do [action]");
- format(string, sizeof(string), "* %s %s", RPName(playerid), result);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- printf("%s", string);
- return 1;
- }
- //===========================================//
- CMD:killme(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- SetPlayerHealth(playerid, 0);
- SendClientMessage(playerid, COLOR_RED, "SERVER: You are dead!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //===========================================//
- CMD:weapon(playerid,params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: You have listed weapon list for administrators!");
- ShowPlayerDialog(playerid, 5, DIALOG_STYLE_TABLIST, "Weapons",
- "Deagle\t0$\t999 Ammo - [ADMIN SHOP]\n\
- M4\t0$\t999 Ammo - [ADMIN SHOP]\n\
- MP5\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Sniper\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Rocket\t0$\t999 Ammo - [ADMIN SHOP]\n\
- TEC-9\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Minigun\t0$\t999 Ammo - [ADMIN SHOP]\n\
- FlameThrower\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Spray\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Chainsaw\t0$\t999 Ammo - [ADMIN SHOP]\n\
- CombatShotgun\t0$\t999 Ammo - [ADMIN SHOP]\n\
- Sawnoff\t0$\t999 Ammo - [ADMIN SHOP]\n\
- AK-47\t0$\t999 Ammo - [ADMIN SHOP]",
- "Select", "Close");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- }
- //===========================================//
- CMD:ateleport(playerid,params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1 )
- {
- ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Admin Teleport Locations", "Bank Los Santos\nChilliad\nLos Santos Police Departament\nGun Shop\nSpawn Civil\nAirport Los Santos\nCNN Los Santos\nBeach\nDealerShip\nDillimore\nAirport Las Venturas\nCNN Las Venturas", "Select", "Close");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- }
- //===========================================//
- CMD:fly(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- StartFly(playerid);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: Flying system ON!");
- SetPlayerHealth(playerid, 9999999999999999999999999999999999.0);
- SetPlayerArmour(playerid, 9999999999999999999999999999999999.0);
- GameTextForPlayer(playerid, "~b~Flying ~r~ System ON!", 3000, 3); //TEXT INFORMATIV MAI SCURT
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- CMD:stopfly(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- StopFly(playerid);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: Flying system OFF!");
- SetPlayerHealth(playerid, 100.0);
- SetPlayerArmour(playerid, 0);
- GameTextForPlayer(playerid, "~b~Flying ~r~ System OFF!", 3000, 3); //TEXT INFORMATIV MAI SCURT
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //===========================================//
- CMD:tune(playerid, params[])
- {
- if(IsPlayerInAnyVehicle(playerid))
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
- AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: Car TUNED!");
- GameTextForPlayer(playerid, "~r~ Car TUNNED!", 3000, 3);
- }
- else
- {
- if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "SERVER: You're not in a vehicle.");
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- CMD:rtune(playerid, params[])
- {
- if(IsPlayerInAnyVehicle(playerid))
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- RemoveVehicleComponent(GetPlayerVehicleID(playerid),1010);
- RemoveVehicleComponent(GetPlayerVehicleID(playerid),1080);
- SendClientMessage(playerid, COLOR_GREEN, "SERVER: Car tunning removed!");
- GameTextForPlayer(playerid, "~r~ Car tunning removed!", 3000, 3);
- }
- else
- {
- if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "SERVER: You're not in a vehicle.");
- SendClientMessage(playerid, COLOR_RED, "SERVER: You must be a level 1+ administrator to use this command!");
- }
- return 1;
- }
- //===========================================//
Advertisement
Add Comment
Please, Sign In to add comment