Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Credits to Y_Less, Dracoblue and Kush.
- #include <a_samp>
- #include <YSI\y_ini>
- #include <sscanf2>
- #include <pvehicle>
- #include <GetVehicleName>
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_SUCCESS_1 3
- #define DIALOG_SUCCESS_2 4
- #define DIALOG_ADVEHICLES 5
- #define PATH "WWAdmin/Users/%s.ini"
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COL_LIGHTBLUE "{00CED1}"
- #define COLOR_RED 0xFF0000FF
- #define COLOR_GREEN 0x00FF00FF
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_BLACK 0x000000FF
- #define COLOR_AQUA 0x00FFFFFF
- #define COLOR_LIGHTPURPLE 0xFF00FFFF
- #define COLOR_BLUE 0x0000FFFF
- #define COLOR_GREY 0x0000005E
- #define MAX_WARNINGS 3
- new VehicleNames[212][] = {
- {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
- {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
- {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
- {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
- {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
- {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
- {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
- {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
- {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
- {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
- {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
- {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
- {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
- {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
- {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
- {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
- {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
- {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
- {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
- {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
- {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
- {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
- {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
- {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
- {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
- {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
- {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
- {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
- {"Utility Trailer"}
- };
- enum sInfo
- {
- sPlayers,
- sBans,
- sKicks,
- sWarns,
- sMutes,
- sKills,
- sDeaths
- }
- new ServerInfo[MAX_PLAYERS][sInfo];
- enum pInfo
- {
- pRegistered,
- pLoggedIn,
- pKicks,
- pWarns,
- pCWarns,
- pBanned,
- pPass,
- pCash,
- pScore,
- pAdmin,
- pKills,
- pDeaths,
- pVip,
- pRank,
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Registered",PlayerInfo[playerid][pRegistered]);
- INI_Int("LoggedIn",PlayerInfo[playerid][pLoggedIn]);
- INI_Int("Kicks",PlayerInfo[playerid][pKicks]);
- INI_Int("Warns",PlayerInfo[playerid][pWarns]);
- INI_Int("CurrentWarns",PlayerInfo[playerid][pCWarns]);
- INI_Int("Banned",PlayerInfo[playerid][pBanned]);
- 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("VipType",PlayerInfo[playerid][pVip]);
- INI_Int("Rank",PlayerInfo[playerid][pRank]);
- 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");
- }
- public OnGameModeInit()
- {
- SetGameModeText("World War lll");
- INI_Load("serverdata.ini");
- 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");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Registered",PlayerInfo[playerid][pRegistered]);
- INI_WriteInt(File,"LoggedIn",PlayerInfo[playerid][pLoggedIn]);
- INI_WriteInt(File,"Kicks",PlayerInfo[playerid][pKicks]);
- INI_WriteInt(File,"Warns",PlayerInfo[playerid][pWarns]);
- INI_WriteInt(File,"CurrentWarns",PlayerInfo[playerid][pCWarns]);
- INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
- 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,"VipType",PlayerInfo[playerid][pVip]);
- INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
- INI_Close(File);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PlayerInfo[killerid][pKills]++;
- PlayerInfo[playerid][pDeaths]++;
- PlayerInfo[playerid][pScore] += 2;
- ServerInfo[playerid][sKills]++;
- ServerInfo[playerid][sDeaths]++;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- //Admin Chat
- if(PlayerInfo[playerid][pAdmin] >= 1 && text[0] == '#')
- {
- new msg[128], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- format(msg, sizeof(msg), "(Admin Chat) %s: %s", pName, text[1]);
- SendMessageToAdmins(msg);
- }
- //VIP Chat
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- //RCON Commands
- dcmd(unbanip, 7, cmdtext);
- //Admin Commands
- dcmd(car, 3, cmdtext);
- dcmd(sethealth, 9, cmdtext);
- dcmd(kick, 4, cmdtext);
- dcmd(ban, 3, cmdtext);
- dcmd(warn, 4, cmdtext);
- dcmd(advehicles, 10, cmdtext);
- dcmd(setvip, 6, cmdtext);
- dcmd(stats, 5, cmdtext);
- return 1;
- }
- dcmd_unbanip(playerid, params[])
- {
- new ip;
- new string[10];
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params,"z", ip)) SendClientMessage(playerid, COLOR_RED, "Usage: /unbanip (IP address)");
- {
- format(string,sizeof(string),"unbanip %s",ip);
- SendRconCommand(string);
- SendClientMessage(playerid, COLOR_RED, "You have sucessfully unbanned IP %s");
- }
- }
- else SendClientMessage(playerid, COLOR_RED, "ERROR: You must be logged into RCON to use this command");
- return 1;
- }
- dcmd_car(playerid,params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 2)
- {
- new Index;
- new tmp[256]; tmp = strtok(params,Index);
- new tmp2[256]; tmp2 = strtok(params,Index);
- new tmp3[256]; tmp3 = strtok(params,Index);
- if(!strlen(tmp)) return
- SendClientMessage(playerid, COLOR_RED, "Usage: /car (Model ID/Name) (Optional: Colour1) (Optional: Colour2)");
- new car;
- new string[128];
- new colour1, colour2;
- if(!IsNumeric(tmp))
- car = GetVehicleModelIDFromName(tmp);
- else car = strval(tmp);
- if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Vehicle Model ID!");
- if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
- if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
- new LVehicleID;
- new Float:X,Float:Y,Float:Z;
- new Float:Angle,int1;
- GetPlayerPos(playerid, X,Y,Z);
- GetPlayerFacingAngle(playerid,Angle);
- int1 = GetPlayerInterior(playerid);
- LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
- LinkVehicleToInterior(LVehicleID,int1);
- format(string, sizeof(string), "-| You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d |-", VehicleNames[car-400], car, colour1, colour2);
- return SendClientMessage(playerid,COLOR_AQUA, string);
- }
- else return SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be level 2 to use this command");
- }
- dcmd_sethealth(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 4 || IsPlayerAdmin(playerid)) // IsPlayerAdmin check (we want only RCON admins to use this command (error message at bottom if the player isn't logged into RCON)
- {
- new id, Float:amount, string[70], pname[MAX_PLAYER_NAME]; // Create the variables needed for this command. id = the id we want to set the health of, amount = the amount we're gonna set id's health to and pName is just where we store id's name.
- if(sscanf(params, "uf", id, amount)) return SendClientMessage(playerid, COLOR_RED, "Usage: /sethealth (id) (amount)");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player not found."); // ID is not connected, send an error message
- else
- {
- GetPlayerName(id, pname, MAX_PLAYER_NAME);
- SetPlayerHealth(id, amount);
- format(string, sizeof(string), "-| You have set %s(%d)'s health to %d |-", pname, id, amount);
- SendClientMessage(playerid, COLOR_AQUA, string);
- return 1;
- }
- }
- else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be Level 4 to use this command.");
- return 1;
- }
- dcmd_kick(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 4 || IsPlayerAdmin(playerid))
- {
- new id;
- new reason[64];
- new idName[MAX_PLAYER_NAME];
- new playeridName[MAX_PLAYER_NAME];
- if(sscanf(params,"uz", id, reason)) SendClientMessage(playerid, 0xFF0000FF, "Usage: /kick (id) (reason)");
- else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not found");
- else
- {
- new str_out[128];//ADDED
- GetPlayerName(id, idName, MAX_PLAYER_NAME);
- GetPlayerName(playerid, playeridName, MAX_PLAYER_NAME);
- format(str_out,sizeof str_out,"You have been kicked by Administrator %s. Reason: %s", playeridName, reason);//added
- SendClientMessage(id, 0xFF0000FF,str_out); //Line 190 //changed
- Kick(id);
- format(str_out,sizeof str_out,"You have succesfully kicked %s for reason: %s", idName, reason);//added
- SendClientMessage(playerid, COLOR_RED, str_out); //Line 192 //changed
- ServerInfo[playerid][sKicks]++;
- PlayerInfo[playerid][pKicks]++;
- return 1;
- }
- }
- else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be Level 4 to use this command.");
- return 1;
- }
- dcmd_ban(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] == 5 || IsPlayerAdmin(playerid))
- {
- new
- id,
- reason[64],
- string1[59],
- string2[41],
- string3[49],
- pname[MAX_PLAYER_NAME],
- pnametwo[MAX_PLAYER_NAME];
- if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, COLOR_RED, "Usage: \"/ban <playerid/partname> <reason (optional)>\"");
- else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "ERROR: Player not found");
- else
- {
- GetPlayerName(playerid, pname, sizeof(pname));
- GetPlayerName(id, pnametwo, sizeof(pnametwo));
- format(string1,sizeof(string1),"-| You have been banned by administrator %s | Reason: %s", pname, reason);
- SendClientMessage(id, COLOR_RED, string1);
- format(string2,sizeof(string2),"-| You have banned %s(%d) | Reason: %s", pnametwo, id, reason);
- SendClientMessage(playerid, COLOR_RED, string2);
- format(string3,sizeof(string3),"-| Administrator %s has banned %s | Reason: %s |-", pname, pnametwo, reason);
- SendClientMessageToAll(COLOR_RED, string3);
- BanEx(id, reason);
- }
- }
- SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be level 5 to use this command");
- return 1;
- }
- dcmd_warn(playerid, params[])
- {
- new
- id,
- string[58],
- string2[53],
- string3[64],
- string4[53],
- string5[63],
- pname1[MAX_PLAYER_NAME],
- pname2[MAX_PLAYER_NAME],
- reason[64];
- if(PlayerInfo[playerid][pAdmin] == 3 || IsPlayerAdmin(playerid))
- {
- if(sscanf(params,"uz", id, reason)) SendClientMessage(playerid, COLOR_RED, "Usage: /warn (id) (reason)");
- {
- GetPlayerName(playerid, pname1, sizeof(pname1));
- GetPlayerName(id, pname2, sizeof(pname2));
- if(PlayerInfo[id][pCWarns] == 1)
- {
- format(string2,sizeof(string2),"-| You have been warned [Warning 1/3] | Reason: %s |-", reason);
- SendClientMessage(id, COLOR_YELLOW, string2);
- format(string3,sizeof(string3),"-| Administrator %s has warned %s [Warning 1/3] | Reason: %s |-", pname1, pname2, reason);
- SendClientMessageToAll(COLOR_YELLOW, string3);
- PlayerInfo[id][pCWarns] = 1;
- PlayerInfo[id][pWarns]++;
- }
- else if(PlayerInfo[id][pCWarns] == 2)
- {
- format(string4,sizeof(string4),"-| You have been warned [Warning 2/3] | Reason: %s |-", reason);
- SendClientMessage(id, COLOR_YELLOW, string4);
- format(string5,sizeof(string5),"-| Administrator %s has warned %s [Warning 2/3] | Reason: %s |-", pname1, pname2, reason);
- SendClientMessageToAll(COLOR_YELLOW, string5);
- PlayerInfo[id][pCWarns] = 2;
- PlayerInfo[id][pWarns]++;
- }
- else if(PlayerInfo[id][pCWarns] == 3)
- {
- format(string,sizeof(string),"-| Player %s has had 3 warnings! He will now be kicked. |-", pname2);
- SendClientMessageToAll(COLOR_YELLOW, string);
- INI_Open(UserPath(playerid));
- PlayerInfo[id][pCWarns] = 0;
- Kick(id);
- return PlayerInfo[playerid][pCWarns] = 0;
- }
- }
- }
- else return SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be Level 3 to use this command");
- return 1;
- }
- dcmd_advehicles(playerid, params[])
- {
- #pragma unused params
- if(PlayerInfo[playerid][pAdmin] == 2 || IsPlayerAdmin(playerid))
- {
- ShowPlayerDialog(playerid, DIALOG_ADVEHICLES, DIALOG_STYLE_LIST, "Admin Vehicles", "Rhino\nHydra\nPatriot\nHunter\nMaverick\nS.W.A.T. Van\nBarracks\nFiretruck", "Spawn", "Cancel");
- }
- else SendClientMessage(playerid, 0xFF0000FF, "ERROR: You need to be Level 2 to use this command");
- return 1;
- }
- dcmd_setvip(playerid,params[])
- {
- if(PlayerInfo[playerid][pLoggedIn] == 1)
- {
- if(PlayerInfo[playerid][pAdmin] >= 5 || IsPlayerAdmin(playerid))
- {
- new tmp [256];
- new tmp2[256];
- new Index;
- tmp = strtok(params,Index);
- tmp2 = strtok(params,Index);
- if(!strlen(params)) return
- SendClientMessage(playerid, COLOR_RED, "Usage: /setvip (Player ID) (AccountType [0-5])");
- new player1, type, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
- player1 = strval(tmp);
- if(!strlen(tmp2)) return
- SendClientMessage(playerid, COLOR_RED, "Usage: /setvip (Player ID) (AccountType [0-5])");
- type = strval(tmp2);
- if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
- {
- if(PlayerInfo[player1][pLoggedIn] == 1)
- {
- if(type > 5)
- return SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid VIP Type!");
- if(type == PlayerInfo[player1][pVip])
- return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is already this VIP level.");
- GetPlayerName(player1, playername, sizeof(playername));
- GetPlayerName(playerid, adminname, sizeof(adminname));
- if(type > 0)
- format(string,sizeof(string),"-| Administrator %s has set your VIP Type to TYPE %d |-",adminname,type);
- else
- format(string,sizeof(string),"|- Administrator %s has set your VIP Type to TYPE 0. |-",adminname);
- SendClientMessage(player1, COLOR_AQUA, string);
- format(string,sizeof(string),"-| You have given %s Account Type: %s |-", playername, type);
- SendClientMessage(playerid,COLOR_AQUA,string);
- new INI:File = INI_Open(UserPath(playerid));
- INI_Open(File);
- INI_WriteInt(File,"VipType",type);
- INI_Close(File);
- PlayerInfo[player1][pVip] = type;
- }
- return SendClientMessage(playerid,COLOR_RED,"ERROR: This player is not logged in");
- }
- else return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected");
- }
- else return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be level 6 or RCON admin to use this command");
- }
- else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be logged in to use this command.");
- }
- dcmd_stats(playerid)
- {
- new string[
- new pName[MAX_PLAYER_NAME];
- new Float: health;
- GetPlayerHeath(playerid, health);
- new Float: armour;
- GetPlayerArmour(playerid, armour);
- new pIP[16];
- GetPlayerIp(playerid, pIP, sizeof(pIP));
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string,sizeof(string),"-| Your Stats (%s) |-", pName);
- SendClientMessage(playerid, COLOR_AQUA, string);
- format(string,sizeof(string),"Name: %s - IP: %s - Health: %d - Armour: %d - Money: $%d", pName, pIP, floatround(health), floatround(armour), GetPlayerMoney(playerid));DestroyAllDynamicObjects()
- 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 OnPlayerPickUpPickup(playerid, pickupid)
- {
- 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 (IsPlayerNPC(playerid)) return 1;
- 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,"Registered",1);
- INI_WriteInt(File,"LoggedIn",0);
- INI_WriteInt(File,"Kicks",0);
- INI_WriteInt(File,"Warns",0);
- INI_WriteInt(File,"Mutes",0);
- INI_WriteInt(File,"Banned",0);
- 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_WriteInt(File,"VipType",0);
- INI_WriteInt(File,"Rank",0);
- INI_Close(File);
- ServerInfo[playerid][sPlayers]++;
- 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(IsPlayerNPC(playerid)) return 1;
- 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","");
- PlayerInfo[playerid][pLoggedIn] = 1;
- }
- 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;
- }
- }
- case DIALOG_ADVEHICLES:
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- CreateVehicleForPlayer(playerid, "432", -1, -1, 1000);
- }
- case 1:
- {
- CreateVehicleForPlayer(playerid, "520", -1, -1, 1000);
- }
- case 2:
- {
- CreateVehicleForPlayer(playerid, "470", -1, -1, 1000);
- }
- case 3:
- {
- CreateVehicleForPlayer(playerid, "425", -1, -1, 1000);
- }
- case 4:
- {
- CreateVehicleForPlayer(playerid, "487", -1, -1, 1000);
- }
- case 5:
- {
- CreateVehicleForPlayer(playerid, "601", -1, -1, 1000);
- }
- case 6:
- {
- CreateVehicleForPlayer(playerid, "433", -1, -1, 1000);
- }
- case 7:
- {
- CreateVehicleForPlayer(playerid, "407", -1, -1, 1000);
- }
- }
- }
- }
- default:
- {
- SendClientMessage(playerid, 0xFF0000FF, "You have cancelled!");
- switch(listitem)
- {
- case 0:
- {
- //Selected Item: "Rhino"
- }
- case 1:
- {
- //Selected Item: "Hydra"
- }
- case 2:
- {
- //Selected Item: "Patriot"
- }
- case 3:
- {
- //Selected Item: "Hunter"
- }
- case 4:
- {
- //Selected Item: "Maverick"
- }
- case 5:
- {
- //Selected Item: "S.W.A.T. Van"
- }
- case 6:
- {
- //Selected Item: "Barracks"
- }
- case 7:
- {
- //Selected Item: "Firetruck"
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- stock pname()
- {
- new pname;
- GetPlayerName(playerid, pname, sizeof(pname));
- return 1;
- }
- 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;
- }
- GetVehicleModelIDFromName(vname[])
- {
- for(new i = 0; i < 211; i++)
- {
- if ( strfind(VehicleNames[i], vname, true) != -1 )
- return i + 400;
- }
- return -1;
- }
- stock IsNumeric(string[])
- {
- for (new i = 0, j = strlen(string);
- i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0')
- return 0;
- }
- return 1;
- }
- stock LoadServerData()
- {
- INI_Load("serverdata.ini");
- print("serverdata.ini Loaded!");
- return 1;
- }
- stock OpenServerDataFile()
- {
- INI_Open("serverdata.ini);
- return 1;
- }
- stock CloseServerDataFile()
- {
- INI_Close("serverdata.ini");
- return 1;
- }
- stock GetVehicleName(modelid)
- {
- return VehicleNames[modelid-400];
- }
- stock SendMessageToAdmins(text[])
- {
- for(new i = 0, i < MAX_PLAYERS, i++)
- {
- if(IsPlayerAdmin(i))
- {
- SendClientMessage(i, -1, text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement