Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==============================================================================
- // 1LLuMiNaTi2's V.I.P Script 2/14/2016 //====================
- //==============================================================================
- #include <a_samp>
- #include <foreach>
- #include <sscanf>
- #include <zcmd>
- #define DIALOG_NONE 2000
- #define DIALOG_COLOR 2001
- #define DIALOG_WEAPS 2000
- #define INF_HEALTH (Float:0x7F800000)
- enum VIP_Enum
- {
- Level,
- Float:X,
- Float:Y,
- Float:Z,
- Interior,
- GodMode
- }
- new VIP[MAX_PLAYERS][VIP_Enum];
- new DB:Database;
- new year, month, day;
- public OnFilterScriptInit()
- {
- print("\n===========================================");
- print(" 1LLuMiNaTi2's V.I.P Script 2/14/2016 ");
- print("===========================================\n");
- Database = db_open("VIPBase.db");
- db_query(Database, "CREATE TABLE IF NOT EXISTS USRDB(NAME, LEVEL, X, Y, Z, INTERIOR)");
- getdate(year, month, day);
- return 1;
- }
- public OnFilterScriptExit()
- {
- foreach(Player, i)
- {
- OnPlayerDisconnect(i, 1);
- }
- db_close(Database);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new
- dbQuery[120], DBResult:dbResult, name[MAX_PLAYER_NAME], str[128];
- GetPlayerName(playerid, name, sizeof(name));
- format(dbQuery, sizeof(dbQuery), "SELECT * FROM USRDB WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(name));
- dbResult = db_query(Database, dbQuery);
- if(db_num_rows(dbResult))
- {
- new Value[15];
- db_get_field_assoc(dbResult, "LEVEL", Value, 35);
- VIP[playerid][Level] = strval(Value);
- db_get_field_assoc(dbResult, "X", Value, 35);
- VIP[playerid][X] = strval(Value);
- db_get_field_assoc(dbResult, "Y", Value, 35);
- VIP[playerid][Y] = strval(Value);
- db_get_field_assoc(dbResult, "Z", Value, 35);
- VIP[playerid][Z] = strval(Value);
- db_get_field_assoc(dbResult, "INTERIOR", Value, 35);
- VIP[playerid][Interior] = strval(Value);
- }
- else
- {
- format(dbQuery, sizeof(dbQuery), "INSERT INTO USRDB(NAME, LEVEL, X, Y, Z, INTERIOR) VALUES('%s', '0', '0.0', '0.0', '0.0', '0')", DB_Escape(name));
- db_query(Database, dbQuery);
- }
- db_free_result(dbResult);
- //==========================================================================
- if(VIP[playerid][Level] >= 1)
- {
- format(str, sizeof(str), "{FF00FF}V.I.P {%06x}%s {FFFFFF}has connected to the server!", name);
- SendClientMessageToAll(-1, str);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new
- dbQuery[120], name[MAX_PLAYER_NAME], DBResult:dbResult;
- GetPlayerName(playerid, name, sizeof(name));
- format(dbQuery, sizeof(dbQuery), "SELECT * FROM USRDB WHERE NAME = '%s'", DB_Escape(name));
- dbResult = db_query(Database, dbQuery);
- if(db_num_rows(dbResult))
- {
- format(dbQuery,sizeof(dbQuery),"UPDATE USRDB SET LEVEL = '%d' WHERE `NAME` = '%s' COLLATE NOCASE", VIP[playerid][Level] , DB_Escape(name));
- db_query(Database, dbQuery);
- }
- db_free_result(dbResult);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(VIP[killerid][Level] >= 1)
- {
- SetPlayerScore(killerid, GetPlayerScore(killerid) + 10);
- SendClientMessage(killerid, -1, "{FF00FF}VIP Bonus:- {FFFFFF}You've got additional 10 scores for killing!");
- }
- return 1;
- }
- public OnVehicleDamageStatusUpdate(vehicleid, playerid)
- {
- if(VIP[playerid][GodMode] == 1)
- {
- new panels, doors, lights, tires;
- GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
- panels = 0;
- doors = 0;
- lights = 0;
- tires = 0;
- UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
- SetVehicleHealth(vehicleid, 99999);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_COLOR)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: SetPlayerColor(playerid, 0xFF0000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 1: SetPlayerColor(playerid, 0x00FF00FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 2: SetPlayerColor(playerid, 0x0000FFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 3: SetPlayerColor(playerid, 0xFFFF00FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 4: SetPlayerColor(playerid, 0xFFFFFFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 5: SetPlayerColor(playerid, 0x000000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 6: SetPlayerColor(playerid, 0x808080FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 7: SetPlayerColor(playerid, 0xFF00CCFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 8: SetPlayerColor(playerid, 0x00FFFFFF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- case 9: SetPlayerColor(playerid, 0x330000FF) , GameTextForPlayer(playerid, "~h~~r~Color Changed", 3000, 3);
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_COLOR)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: GivePlayerWeapon(playerid, 35, 99999);
- case 1: GivePlayerWeapon(playerid, 38, 99999);
- case 2: GivePlayerWeapon(playerid, 36, 99999);
- case 3: GivePlayerWeapon(playerid, 37, 99999);
- case 4: GivePlayerWeapon(playerid, 24, 99999);
- case 5: GivePlayerWeapon(playerid, 26, 99999);
- case 6: GivePlayerWeapon(playerid, 31, 99999);
- case 7: GivePlayerWeapon(playerid, 28, 99999);
- case 8: GivePlayerWeapon(playerid, 9, 1);
- case 9: GivePlayerWeapon(playerid, 16, 99999);
- }
- }
- return 1;
- }
- return 0;
- }
- CMD:setvip(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new str[170], targetid, level;
- if(sscanf(params, "ii", targetid, level)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /setvip (Playerid) (Level)");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Player is not connected.");
- if(level > 3 || level < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Level.");
- format(str, sizeof(str), "{FF0000}Administrator {FFFFFF}%s has set %s's {00FF00}V.I.P Level {FFFFFF}to {00FF00}%d {FFFFFF}%d/%d/%d", Name(playerid), Name(targetid), level, month, day, year);
- SendClientMessageToAll(-1, str);
- VIP[targetid][Level] = level;
- }
- return 1;
- }
- CMD:savepos(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- new Query[120], Float:x, Float:y, Float:z, Int;
- GetPlayerPos(playerid, x,y,z);
- Int = GetPlayerInterior(playerid);
- GameTextForPlayer(playerid, "~r~Position Saved!", 3000, 3);
- format(Query,sizeof(Query),"UPDATE USRDB SET X = '%0.2f', Y = '%0.2f', Z = '%0.2f', INTERIOR = '%d' WHERE `NAME` = '%s' COLLATE NOCASE", x, y, z, Int, DB_Escape(Name(playerid)));
- VIP[playerid][X] = x;
- VIP[playerid][Y] = y;
- VIP[playerid][Z] = z;
- VIP[playerid][Interior] = Int;
- db_query(Database, Query);
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:loadpos(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- GameTextForPlayer(playerid, "~g~Position Loaded!", 3000, 3);
- SetPlayerPos(playerid, VIP[playerid][X], VIP[playerid][Y], VIP[playerid][Z]);
- SetPlayerInterior(playerid, VIP[playerid][Interior]);
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vheal(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- SetPlayerHealth(playerid, 100);
- GameTextForPlayer(playerid, "~r~Health Refilled!", 3000, 3);
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:varmour(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- SetPlayerArmour(playerid, 100);
- GameTextForPlayer(playerid, "~g~Armour Refilled!", 3000, 3);
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vgod(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- new Veh = GetPlayerVehicleID(playerid);
- if(VIP[playerid][GodMode] == 1)
- {
- VIP[playerid][GodMode] = 0;
- SetPlayerHealth(playerid, 100);
- SetVehicleHealth(Veh, 99999);
- GameTextForPlayer(playerid, "~r~GOD MODE OFF!", 3000, 3);
- }
- else if(VIP[playerid][GodMode] == 0)
- {
- VIP[playerid][GodMode] = 1;
- SetPlayerHealth(playerid, INF_HEALTH);
- SetVehicleHealth(Veh, 99999);
- GameTextForPlayer(playerid, "~r~GOD MODE ON!", 3000, 3);
- }
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vcolor(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- GameTextForPlayer(playerid, "~r~COLORS", 3000, 3);
- ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "VIP {00FF00}Colors", "{FF0000}Red\n{00FF00}Green\n\
- {0000FF}Blue\n{FFFF00}Yellow\n{FFFFFF}White\n{000000}Black\n{808080}Gray\n\
- {FF00CC}Purple\n{00FFFF}Aqua\n{330000}Brown", "Choose", "Exit");
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vsay(playerid, params[])
- {
- if(VIP[playerid][Level] >= 1)
- {
- new text[128], str[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vsay [Text]");
- format(str, sizeof(str), "{FF00CC}** V.I.P {%06x}%s[%d]{FFFFFF}: %s {FF00CC}**", GetPlayerColor(playerid) >>> 8, Name(playerid), playerid, text);
- SendClientMessageToAll(-1, str);
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vnos(playerid)
- {
- if(VIP[playerid][Level] >= 1)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not in a vehicle!");
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vskin(playerid, params[])
- {
- if(VIP[playerid][Level] >= 1)
- {
- new skin;
- if(sscanf(params, "i", skin)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vskin [ID]");
- if(skin > 311 || skin < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Skin ID.");
- GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
- SetPlayerSkin(playerid, skin);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vweap(playerid, params[])
- {
- if(VIP[playerid][Level] >= 1)
- {
- new weap;
- if(sscanf(params, "i", weap)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vweap [ID]");
- if(weap > 46 || weap < 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Weapon ID.");
- GameTextForPlayer(playerid, "~g~Weapon Given!", 3000, 3);
- GivePlayerWeapon(playerid, weap, 99999);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vcar(playerid, params[])
- {
- if(VIP[playerid][Level] >= 2)
- {
- new car, Float:x, Float:y, Float:z, Float:a;
- if(sscanf(params, "i", car)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vcar [ID]");
- if(car > 609 || car < 400) return SendClientMessage(playerid, -1, "{FF0000}ERROR: Invalid Vehicle ID.");
- GameTextForPlayer(playerid, "~g~Vehicle Spawned!", 3000, 3);
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, a);
- CreateVehicle(car, x, y, z, a, 0, 0, -1);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vweaps(playerid)
- {
- if(VIP[playerid][Level] >= 2)
- {
- ShowPlayerDialog(playerid, DIALOG_WEAPS, DIALOG_STYLE_LIST, "{0000FF}VIP Special Weapons", "{FF00FF}RPG\nMinigun\nHeat Seeker\nFlame Thrower\nDesert Eagle\nSawn OFF\nSniper\nM4\nUZI\nChainsaw\nGrenade", "Choose", "Close");
- GameTextForPlayer(playerid, "~r~Select Weapon", 3000, 3);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vhouse(playerid)
- {
- if(VIP[playerid][Level] >= 2)
- {
- GameTextForPlayer(playerid, "~r~V.I.P House", 3000, 3);
- SetPlayerPos(playerid, 1267.663208,-781.323242,1091.906250);
- SetPlayerInterior(playerid, 5);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vweather(playerid, params[])
- {
- if(VIP[playerid][Level] >= 2)
- {
- new weath;
- if(sscanf(params, "i", weath)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vwather [ID]");
- GameTextForPlayer(playerid, "~g~Weather Changed!", 3000, 3);
- SetPlayerWeather(playerid, weath);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vtime(playerid, params[])
- {
- if(VIP[playerid][Level] >= 2)
- {
- new time;
- if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /vtime [ID]");
- GameTextForPlayer(playerid, "~g~Time Changed!", 3000, 3);
- SetPlayerTime(playerid, time, 0);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:v(playerid, params[])
- {
- if(VIP[playerid][Level] >= 1)
- {
- new text[128], str[128];
- if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "{FF0000}Correct Usage: /v [Text]");
- format(str, sizeof(str), "{FF00CC}V.I.P Chat {%06x}%s[%d]{FFFFFF}: %s", GetPlayerColor(playerid) >>> 8, Name(playerid), playerid, text);
- foreach(Player, i)
- {
- SendClientMessage(i, -1, str);
- }
- }
- else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vjetpack(playerid, params[])
- {
- if(VIP[playerid][Level] >= 2)
- {
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vammo(playerid, params[])
- {
- if(VIP[playerid][Level] >= 3)
- {
- SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 99999);
- SendClientMessage(playerid, -1, "Current Weapon's Ammo Set To Max Value!");
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vminigun(playerid, params[])
- {
- if(VIP[playerid][Level] >= 3)
- {
- GivePlayerWeapon(playerid, 38, 99999);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vfix(playerid)
- {
- if(VIP[playerid][Level] >= 3)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new panels, doors, lights, tires, vehicleid;
- vehicleid = GetPlayerVehicleID(playerid);
- GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
- panels = 0;
- doors = 0;
- lights = 0;
- tires = 0;
- UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
- SetVehicleHealth(vehicleid, 1000);
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not in a vehicle.");
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vmws(playerid)
- {
- if(VIP[playerid][Level] >= 3)
- {
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
- SendClientMessage(playerid, -1, "Weapons Skills has been set to the maximum value!");
- } else SendClientMessage(playerid, -1, "{FF0000}ERROR: You're not authorized to use this command.");
- return 1;
- }
- CMD:vcmds(playerid)
- {
- ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "{FF0000}Very {FFFFFF}Important {0000FF}Person", "Level 1 (Bronze): \
- /savepos, /loadpos, /vheal, /varmour, /vgod, /vcolor, /vnos, /vskin, /vweap, /v (MSG)\n\
- Level 2 (Silver): /vweaps, /vhouse, /vweather, /vtime, /vjetpack, /vcar, /vsay\
- Level 3 (Gold): /vammo, /vminigun, /vfix, /vmws (Max Weapons Skills)", "Close", "");
- return 1;
- }
- CMD:vips(playerid)
- {
- new str[128];
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(VIP[playerid][Level] >= 1)
- {
- format(str, sizeof(str), "%s {FF00FF}(%s V.I.P)\n", Name(i), VIPRankName(i));
- ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "Online {0000FF}Very {FFFFFF}Important {FF0000}Persons", str, "Close", "");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_NONE, DIALOG_STYLE_MSGBOX, "Online {0000FF}Very {FFFFFF}Important {FF0000}Persons", "No Online Very Important Persons", "Close", "");
- }
- }
- return 1;
- }
- //==============================================================================
- stock Name(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock VIPRankName(playerid)
- {
- new str[128];
- switch(VIP[playerid][Level])
- {
- case 0: str = "Bronze";
- case 1: str = "Silver";
- case 2: str = "Gold";
- }
- return str;
- }
- //==============================================================================
- stock DB_Escape(text[])
- {
- new
- ret[80 * 2],
- ch,
- i,
- j;
- while ((ch = text[i++]) && j < sizeof (ret))
- {
- if (ch == '\'')
- {
- if (j < sizeof (ret) - 2)
- {
- ret[j++] = '\'';
- ret[j++] = '\'';
- }
- }
- else if (j < sizeof (ret))
- {
- ret[j++] = ch;
- }
- else
- {
- j++;
- }
- }
- ret[sizeof (ret) - 1] = '\0';
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement