Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_mysql>
- // time
- #include <a_inc>
- include>a_tiempos;
- //include>a; //Incluir toda la librería
- #include <a_inc2>
- //time
- #include <zcmd>
- #include <streamer>
- #include <youtube>
- #include <foreach>
- #include <sscanf>
- #include "../include/gl_common.inc"
- #include <YSI\y_ini>
- static
- const
- DB_HOST[] = "localhost", // - Host | IP donde se aloja la base de datos.
- DB_USER[] = "root" , // - Usuario mediante el cual se accederá.
- DB_PASSWORD[] = "" , // - Password para el ingreso con el usuario.
- DB_DB[] = "wDealer" ; // - Nombre de la base de datos.
- #define function::%0(%1) \
- forward%0(%1); \
- public%0(%1)
- #define MAX_DEALERS 10 // - Cantidad de concesionarios.
- #define MAX_DEALER_VEHICLES 13 // - Cantidad máxima de autos que pueden estar en venta.
- #define MAX_VEH_INDEALER ( 10 ) // - Cantidad de autos que puede haber en cada concesionario.
- #define MAX_VEH_PER_PLAYER ( 2 ) // - Cantidad máxima de autos por jugador.
- #define VEH_ENGINE ( 0 )
- #define VEH_LIGHTS ( 1 )
- #define VEH_ALARM ( 2 )
- #define VEH_LOCK ( 3 )
- #define VEH_BONNET ( 4 )
- #define VEH_BOOT ( 5 )
- #define VEH_OBJECTIVE ( 6 )
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 32 // Here you need to set the maximum number of players able to play on your server at any given time, I'll put 32 because that's the max players on my server.
- #define Grey 0xC0C0C0FF // Defining the color 'Grey'
- #define DIALOG_DUEL 24245
- new bool:InvitedDuel[MAX_PLAYERS];
- new IdDuel[MAX_PLAYERS];
- new bool:UsingArena;
- new Counting = 5;
- new CountDueling[5][5] ={"~r~1","~b~2","~p~3","~y~4","~g~5"};
- new TCrear:csancion[MAX_PLAYERS];
- //Colorlist
- #define COL_RED "{F81414}"
- #define COL_LIGHTBLUE "{00C0FF}"
- #define COL_LRED "{FFA1A1}"
- #define COL_GREEN "{6EF83C}"
- #define COL_GREY "{C3C3C3}"
- #define COLOR_GREY 0x808080FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_GREEN 0x088A08FF
- #define COLOR_GREEN2 0x00FF00FF
- #define Black 0x00000000
- #define COLOR_RED 0xAA3333AA
- #define TuServer "TuServer"
- #pragma tabsize 0
- #define SMusica 10004
- #define DMusica 10005
- new TempStr[255];
- new InJail[MAX_PLAYERS];
- new FPS[MAX_PLAYERS];
- new FPSS[MAX_PLAYERS];
- new Text:ArribaVida[MAX_PLAYERS];
- #define DIALOG_MUSICPLAYER 1
- //Dialogs
- #define DIALOG_REG 1995
- #define DIALOG_REG_REQ 1996
- #define DIALOG_LOGIN 1997
- #define DIALOG_LOGIN2 1998
- #define DIALOG_LOG_DONE 1999
- #define DIALOG_LOG 2000
- #define DIALOG_STATS 2001
- #define INFO_BOX 2002
- new Zona[MAX_PLAYERS];
- //level admin
- #define Level0 "Usuario"
- #define Level1 "Moderador"
- #define Level2 "Administrador"
- #define Level3 "Dueño"
- native sscanf(const data[], const format[], {Float,_}:...);
- //native unformat(const data[], const format[], {Float,_}:...) = sscanf;
- enum // - Dialogs.
- {
- showAnounceVehicle, // 0 - Dialogo para mostrar cartel de venta del vehículo.
- showPlayerVehicles, // 1 - Dialogo para visualizar los vehículos del usuario.
- showMenuCreateDealer, // 2 - Dialogo para visualizar el menú de creación de concesionarios.
- createDealerName, // 3 - Dialogo para cambiar el nombre del concesionario (creación).
- showdealerInfoBox, // 4 - Dialogo para la compra de vehículos.
- showMenuDealerEdit, // 5 - Dialogo para la edición de los concesionarios.
- editDealerName // 6 - Dialogo para la edición del nombre del concesionario.
- };
- enum // - Threads.
- {
- empty@queryReceived, // 0 - Para recibir las query's vacías ( sin parámetros ).
- dealerDataAssign, // 1 - Para cargar los datos de los vehículos del concesionario.
- dealerAssign, // 2 - Para asignar los datos de los concesionarios.
- load@playerVehicles, // 3 - Para leer los vehículos del usuario.
- sql@insertID, // 4 - Para asignar la ID en la tabla al vehículo creado.
- sql_d@insertID, // 5 - Para asignar la ID en la tabla al vehículo de concesionario creado.
- sql@dealerInsertID,
- };
- //============================================================================//
- enum dealerLoc
- {
- id@sqlid, // - ID del concesionario en la tabla.
- id@num, // - ID del concesionario en el servidor.
- sz@nameDealer[0x1E], // - Nombre del concesionario.
- d@vehicles, // - Cantidad de vehículos del concesionario.
- Float:f@maxX, // - Coordenada X máxima.
- Float:f@minX, // - Coordenada X mínima.
- Float:f@maxY, // - Coordenada Y máxima.
- Float:f@minY // - Coordenada Y mínima.
- };
- //============================================================================//
- enum dealerEnum
- {
- inumdID, // - ID del vehículo en la tabla.
- inumID, // - ID del vehículo en el servidor.
- sCarName[0x1E], // - Nombre del vehículo.
- inumDealer, // - Concesionario.
- iModel, // - Modelo del vehículo.
- iPrice, // - Costo del auto.
- Float:fdPos_X, // - Coordenada x ( posición del auto en el concesionario ).
- Float:fdPos_Y, // - Coordenada y ( || ).
- Float:fdPos_Z, // - Coordenada z ( || ).
- Float:fdPos_R // - Angúlo de rotación ( || ).
- };
- //============================================================================//
- enum trunkVeh // Maletero.
- {
- tArmas[0b101], // - Slots para armas.
- tMuniciones[0b101], // - Slots para municiones.
- Float:tArmadura // - Slots para chaleco.
- };
- enum modsVeh
- {
- mColores[0b10],
- mSpoiler,
- mHood,
- mRoof,
- mSideskirts[0b10],
- mNitro,
- mLamps,
- mExhaust,
- mWheels,
- mStereo,
- mHidraulics,
- mPaintjob,
- mBullbar,
- mRealBullbars,
- mFrontSign,
- mFrontBullbars,
- mBullbars,
- mRearBumper,
- mVents[0b10],
- mFrontBumper
- };
- enum paramsV // Parámetros funcionales.
- {
- pEngine,
- pLights,
- pAlarm,
- ptAlarm,
- pLock,
- pBonnet,
- pBoot,
- pObjective
- };
- enum damageV // Daño del vehículo.
- {
- Float:dHealth,
- dPanels,
- dDoors,
- dLights,
- dTires
- };
- enum carEnum
- {
- inumcID, // - ID del vehículo en la tabla.
- icnumID, // - ID del vehículo en el servidor.
- sCarName[0x19], // - Nombre del vehículo.
- sCarOwner[0x19], // - Nombre del dueño del vehículo.
- idOwner, // - ID del dueño del vehículo.
- iModel, // - Modelo del vehículo.
- ipRepair, // - Costo de la reparación ( seguro ).
- bool:status, // - false = Vehículo destruido.
- Float:fPos_X, // - Coordenada x ( posición del auto en el concesionario ).
- Float:fPos_Y, // - Coordenada y ( || ).
- Float:fPos_Z, // - Coordenada z ( || ).
- Float:fPos_R, // - Angúlo de rotación ( || ).
- paramsVeh[paramsV], // - Parámetros funcionales del vehículo.
- damageVeh[damageV], // - Estatus de daño.
- mods[modsVeh], // - Modificaciones del vehículo.
- Maletero[trunkVeh] // - Maletero del vehículo.
- };
- new God[ MAX_PLAYERS ], CGod[ MAX_PLAYERS ];
- new Float:JailCellSpawns[][3] =
- {
- {197.3941,162.4637,1003.0300},
- {194.3641,175.6378,1003.0234},
- {197.8117,174.2043,1003.0234}
- };
- new
- cHandle , // - Para realizar la conexión.
- paramsvDealer [ MAX_VEHICLES ][ dealerEnum ], // - Almacenará los datos de los autos del/los concesionarios.
- playerVehicle [ MAX_PLAYERS ][MAX_VEH_PER_PLAYER][carEnum], // - Almacenará los datos de los autos de los usuarios.
- dealerLocations [ MAX_DEALERS+1 ][ dealerLoc ], // - Almacenará los datos de los concesionarios.
- d@optionsEdit [ MAX_PLAYERS ][ 0b101 ], // - Almacenará los valores para los menús de edición.
- i@timerUpDealer, // - Timer que guarda los vehículos del concesionario cada X tiempo.
- obs@Venta [ MAX_PLAYERS ][ 0b100 ], // - Almacenará la ID del vehículo en venta que vamos a comprar.
- //Piezas de modificación.
- Spoiler[20] = {
- 1000, 1001, 1002, 1003,
- 1014, 1015, 1016, 1023,
- 1049, 1050, 1058, 1060,
- 1138, 1139, 1146, 1147,
- 1158, 1162, 1163, 1164,
- },
- Hood[4] = {
- 1004, 1005, 1011, 1012
- },
- Roof[17] = {
- 1006, 1032, 1033, 1035,
- 1038, 1053, 1054, 1055,
- 1061, 1067, 1068, 1088,
- 1091, 1103, 1128, 1130,
- 1131
- },
- RightSideskirt[22] = {
- 1007, 1026, 1031, 1036,
- 1041, 1042, 1047, 1048,
- 1056, 1057, 1069, 1070,
- 1090, 1093, 1095, 1106,
- 1108, 1118, 1119, 1122,
- 1133, 1134
- },
- LeftSideskirt[20] = {
- 1017, 1027, 1030, 1039,
- 1040, 1051, 1052, 1062,
- 1063, 1071, 1072, 1094,
- 1099, 1101, 1102, 1107,
- 1120, 1121, 1124, 1137
- },
- Nitro[3] = {
- 1008, 1009, 1010
- },
- Lamps[2] = {
- 1013, 1024
- },
- Exhaust[29] = {
- 1018, 1019, 1020, 1021,
- 1022, 1028, 1029, 1034,
- 1037, 1043, 1044, 1045,
- 1046, 1059, 1064, 1065,
- 1066, 1089, 1092, 1104,
- 1105, 1113, 1114, 1126,
- 1127, 1129, 1132, 1135,
- 1136
- },
- Wheels[17] = {
- 1025, 1073, 1074, 1075,
- 1076, 1077, 1078, 1079,
- 1080, 1081, 1082, 1083,
- 1084, 1085, 1096, 1097,
- 1098
- },
- Stereo = 1086,
- Hidraulics = 1087,
- Bullbar = 1100,
- RealBullbars[2] = {
- 1109, 1110
- },
- FrontSign[2] = {
- 1111, 1112
- },
- FrontBullbars[2]={
- 1115, 1116
- },
- FrontBumper[23] ={
- 1117, 1152, 1153, 1155,
- 1157, 1160, 1165, 1166,
- 1169, 1170, 1171, 1172,
- 1173, 1174, 1175, 1179,
- 1181, 1182, 1185, 1188,
- 1189, 1190, 1191
- },
- Bullbars = 1125,
- RearBumper[22] = {
- 1140, 1141, 1148, 1149,
- 1150, 1151, 1154, 1156,
- 1159, 1161, 1167, 1168,
- 1176, 1177, 1178, 1180,
- 1183, 1184, 1186, 1187,
- 1192, 1193
- },
- RightVents[2] = {
- 1143, 1145
- },
- LeftVents[2] = {
- 1142, 1144
- },
- Float:paynspray[][] = { //Pay N'Spray locations.
- {1025.05 , -1024.23 , 32.1}, // LS Temple
- {487.68 , -1740.87 , 11.13}, // LS Santa Maria
- {-1420.73 , 2583.37 , 55.56}, // El Quebrados
- {-1904.39 , 284.97 , 40.75}, // Wang Cars
- {-2425.91 , 1022.33 , 50.10}, // Juniper Hill
- {1975.60 , 2162.16 , 10.77}, // LV Redsands
- {2065.38 , -1831.51 , 13.25}, // Idlewood
- {-99.55 , 1118.36 , 19.44}, // Fort Carson
- {721.07 , -455.94 , 16.04}, // Dillimore
- {2393.74 , 1493.01 , 10.52} // LV Unused (Pyramid)
- };
- static const n@Vehicles[0b11010100][] = {
- !"Landstalker" , !"Bravura" , !"Buffalo" , !"Linerunner" , !"Perennial" , !"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" , !"Previon" , !"Coach" , !"Cabbie" , !"Stallion" , !"Rumpo" , !"RC Bandit" ,
- !"Romero" , !"Packer" , !"Monster" , !"Admiral" , !"Squalo" , !"Seasparrow" , !"Pizzaboy" ,
- !"Tram" , !"Trailer" , !"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" , !"Hotring Racer" , !"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" , !"Hustler" , !"Intruder" ,
- !"Primo" , !"Cargobob" , !"Tampa" , !"Sunrise" , !"Merit" , !"Utility Truck" , !"Nevada" ,
- !"Yosemite" , !"Windsor" , !"Monster" , !"Monster" , !"Uranus" , !"Jester" , !"Sultan" ,
- !"Stratum" , !"Elegy" , !"Raindance" , !"RCTiger" , !"Flash" , !"Tahoma" , !"Savanna" ,
- !"Bandito" , !"Freight" , !"Trailer" , !"Kart" , !"Mower" , !"Dune" , !"Sweeper" ,
- !"Broadway" , !"Tornado" , !"AT-400" , !"DFT-30" , !"Huntley" , !"Stafford" , !"BF-400" ,
- !"Newsvan" , !"Tug" , !"Trailer" , !"Emperor" , !"Wayfarer" , !"Euros" , !"Hotdog" ,
- !"Club" , !"Trailer" , !"Trailer" , !"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" ,!"Luggage Trailer", !"Stair Trailer" , !"Boxville" ,
- !"Farm Plow" , !"Utility Trailer"
- };
- /*isNumeric( string[] )
- {
- //--------------------------------------------------
- // * isNumeric
- // * Params:
- // - string
- // * Función:
- // - Verifica sí una cadena de texto es solamente
- // numerica, de ser así, retorna true, de lo contrario
- // false.
- //--------------------------------------------------
- for( new i = strlen( string )-1; i > 0; --i )
- {
- if( '0' > string[i] || string[i] > '9' ) return false;
- else continue;
- }
- return true;
- }
- */
- forward ExecuteCount(playerid,pid);
- public ExecuteCount(playerid,pid)
- {
- if (Counting > 0)
- {
- GameTextForPlayer(playerid,CountDueling[Counting-1], 2500, 3);
- GameTextForPlayer(pid,CountDueling[Counting-1], 1000, 3);
- Counting--;
- SetTimerEx("GoDuel",1000,false,"ii",playerid,pid);
- }
- else
- {
- GameTextForPlayer(playerid,"~>~~g~Go~w~Go~r~Go~b~Go~<~", 2500, 3);
- GameTextForPlayer(pid,"~>~~g~Go~w~Go~r~Go~b~Go~<~", 2500, 3);
- Counting = 5;
- TogglePlayerControllable(playerid,true);
- TogglePlayerControllable(pid,true);
- }
- return 1;
- }
- forward GoDuel(playerid,pid);
- public GoDuel(playerid,pid)
- {
- //-> Go To X1 <-//
- //SetPlayerPos
- //SetPlayerArmor
- //SetPlayerHealth
- //-> Functions for Count x1<-//
- TogglePlayerControllable(playerid,false);
- TogglePlayerControllable(pid,false);
- ExecuteCount(playerid,pid);
- return 1;
- }
- forward ExpireDuel(playerid,pid);
- public ExpireDuel(playerid,pid)
- {
- if(UsingArena == false)
- {
- SendClientMessage(pid,0x1DF6F6AA,"»»[DUEL]«« : Expired challenge, He Refused");
- SendClientMessage(playerid,0x1DF6F6AA,"»»[DUEL]«« : Expired challenge, you automatically refuse");
- InvitedDuel[pid] = false;
- InvitedDuel[playerid] = false;
- IdDuel[playerid] = playerid;
- IdDuel[pid] = pid;
- }
- return 1;
- }
- forward UnJail(pId);
- //public OnFilterScriptInit( ) return 1;
- //public OnFilterScriptExit( ) return 1;
- public OnFilterScriptInit()
- {
- for(new i; i < GetMaxPlayers(); i ++)// BY Tribisk
- {// BY Tribisk
- ArribaVida[i] = TextDrawCreate(485.000000, 5.000000, "_");
- TextDrawBackgroundColor(ArribaVida[i], 255);
- TextDrawFont(ArribaVida[i], 2);
- TextDrawLetterSize(ArribaVida[i], 0.350000, 1.500000);
- TextDrawColor(ArribaVida[i], -1628110593);
- TextDrawSetOutline(ArribaVida[i], 1);
- TextDrawSetProportional(ArribaVida[i], 1);
- }
- CreateDynamicObject(3095, 1745.2294921875, -2835.8447265625, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2835.8447265625, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2844.833984375, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2844.833984375, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2853.8239746094, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2853.8239746094, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2551269531, -2835.8447265625, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2551269531, -2844.833984375, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2551269531, -2853.8232421875, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2862.8132324219, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2862.8132324219, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2548828125, -2862.8132324219, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2648925781, -2835.8447265625, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2648925781, -2844.833984375, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2648925781, -2853.8232421875, 5, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2648925781, -2862.8125, 5, 0, 0, 0);
- CreateDynamicObject(3401, 1742.7684326172, -2859.9912109375, 7.9004049301147, 0, 0, 0);
- CreateDynamicObject(994, 1742.6313476563, -2852.4506835938, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(994, 1736.0305175781, -2852.4506835938, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(3095, 1749.6668701172, -2835.8447265625, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1749.666015625, -2862.8134765625, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1749.666015625, -2853.8232421875, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1749.666015625, -2844.833984375, 9.5, 0, 90, 0);
- CreateDynamicObject(994, 1734.8913574219, -2866.2641601563, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1734.890625, -2859.5632324219, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(3401, 1742.7684326172, -2838.2465820313, 7.9004049301147, 0, 0, 0);
- CreateDynamicObject(994, 1742.630859375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(994, 1736.0302734375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(994, 1734.890625, -2838.0625, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1734.890625, -2844.8625488281, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(3095, 1745.2294921875, -2830.8447265625, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1736.2451171875, -2830.8447265625, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1718.2648925781, -2830.8447265625, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1727.2551269531, -2830.8447265625, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1713.2648925781, -2862.8125, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1713.2646484375, -2835.8447265625, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1713.2646484375, -2844.833984375, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1713.2646484375, -2853.8232421875, 9.5, 0, 90, 0);
- CreateDynamicObject(3095, 1718.2648925781, -2866.8125, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1727.2548828125, -2866.8125, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1736.2451171875, -2866.8125, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1745.2294921875, -2866.8125, 9.5, 0, 90, 270);
- CreateDynamicObject(3095, 1745.2294921875, -2835.8447265625, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2835.8447265625, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2844.833984375, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2844.833984375, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2853.8232421875, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1745.2294921875, -2862.8125, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2853.8232421875, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1736.2451171875, -2862.8125, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3401, 1720.767578125, -2838.24609375, 7.9004049301147, 0, 0, 0);
- CreateDynamicObject(994, 1728.2906494141, -2838.0625, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1728.2906494141, -2844.8623046875, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1714.0302734375, -2845.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(994, 1720.7302246094, -2845.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(3401, 1720.767578125, -2859.9912109375, 7.9004049301147, 0, 0, 0);
- CreateDynamicObject(994, 1728.2906494141, -2866.263671875, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1728.2906494141, -2859.5625, 5.555365562439, 0, 0, 90);
- CreateDynamicObject(994, 1714.0302734375, -2852.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(994, 1720.7294921875, -2852.4501953125, 5.5881395339966, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2548828125, -2862.8125, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2646484375, -2862.8125, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2548828125, -2853.8232421875, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2646484375, -2853.8232421875, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2548828125, -2844.833984375, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2646484375, -2844.833984375, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1727.2548828125, -2835.8447265625, 10.199999809265, 0, 0, 0);
- CreateDynamicObject(3095, 1718.2646484375, -2835.8447265625, 10.199999809265, 0, 0, 0);
- CreateObject(3115, -57.761909484863, 7.0930023193359, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -78.688957214355, 7.070351600647, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -99.440689086914, 7.0603914260864, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -120.2462387085, 7.0959548950195, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -120.23681640625, 25.553907394409, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -99.342819213867, 25.540832519531, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -78.641998291016, 25.528993606567, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -57.715682983398, 25.494049072266, 885.82507324219, 0, 0, 0);
- CreateObject(3113, -120.91625976563, -16.560354232788, 885.70471191406, 0, 0, 0);
- CreateObject(3113, -56.472980499268, 29.458341598511, 885.70471191406, 0, 0, 182);
- CreateObject(3115, -57.805652618408, -11.350317955017, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -78.479759216309, -11.408630371094, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -99.381126403809, -11.399437904358, 885.82507324219, 0, 0, 0);
- CreateObject(3115, -120.2375793457, -11.39008808136, 885.82507324219, 0, 0, 0);
- CreateObject(3279, -112.25547790527, 21.11877822876, 885.94049072266, 0, 0, 0);
- CreateObject(3279, -65.336082458496, -5.0633420944214, 885.91546630859, 0, 0, 0);
- CreateObject(3585, -86.349952697754, 5.2061915397644, 887.41088867188, 88, 0, 0);
- CreateObject(3585, -80.42951965332, 18.863157272339, 887.61059570313, 1.7499694824219, 0, 44);
- CreateObject(3066, -108.33284759521, 7.6853895187378, 887.21362304688, 0, 0, 0);
- CreateObject(3378, -97.802230834961, 19.364957809448, 887.17401123047, 0, 0, 0);
- CreateObject(18257, -65.25798034668, 0.77261352539063, 886.00579833984, 0, 0, 0);
- CreateObject(925, -79.144248962402, -8.0238285064697, 887.10107421875, 0, 0, 0);
- CreateObject(925, -79.904083251953, -10.141017913818, 887.05102539063, 0, 0, 0);
- CreateObject(925, -83.34806060791, -8.6378335952759, 887.02600097656, 0, 0, 0);
- CreateObject(2669, -125.74849700928, -10.830086708069, 887.49591064453, 0, 0, 179.99993896484);
- CreateObject(2669, -51.033828735352, 25.199251174927, 887.49591064453, 0, 0, 359.99450683594);
- CreateObject(3569, -98.190414428711, -10.710907936096, 888.3251953125, 0, 0, 215.99993896484);
- CreateObject(3621, -86.145454406738, 38.478546142578, 890.79559326172, 0, 0, 0);
- CreateObject(3621, -88.916091918945, -24.332460403442, 890.79559326172, 0, 0, 179.49993896484);
- CreateObject(3621, -43.779098510742, 19.922342300415, 890.79559326172, 0, 0, 91.49462890625);
- CreateObject(3621, -134.17524719238, 11.865221977234, 890.79559326172, 0, 0, 89.494140625);
- CreateObject(12930, -91.454383850098, -10.372987747192, 886.87579345703, 0, 0, 0);
- CreateObject(13489, -66.051818847656, 24.42193031311, 888.36895751953, 0, 0, 0);
- CreateObject(16599, -62.442291259766, 13.125249862671, 890.56274414063, 0, 0, 0);
- CreateObject(2991, -73.213287353516, 9.7080383300781, 886.75830078125, 0, 0, 0);
- CreateObject(2991, -73.212890625, 9.7080078125, 888.00830078125, 0, 0, 0);
- CreateObject(2991, -73.212890625, 9.7080078125, 889.00830078125, 0, 0, 0);
- ManualVehicleEngineAndLights();
- i@timerUpDealer = SetTimer("save@DealersData", ( 3516 << 8) /*13000*/, false);
- return verifyConnection(), 0x01;
- }
- public OnFilterScriptExit()
- {
- KillTimer( i@timerUpDealer );
- return mysql_close(cHandle), 0x01;
- }
- stock GivePlayerScore( playerid, score ) SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );
- //Forwards
- forward GetVehicleModelIDFromName(vname[]);
- forward DestroyPlayerSpawnedVehicles();
- //Defines
- forward KickPublic(playerid);
- public KickPublic(playerid) { Kick(playerid); }
- stock KickWithMessage(playerid)
- {
- //SendClientMessage(playerid, 0xFF4444FF, message);
- SetTimerEx("KickPublic", 1000, 0, "d", playerid); //Delay of 1 second before kicking the player so he recieves the message
- }
- forward ParsePlayerPass( playerid, name[ ], value[ ] );
- public ParsePlayerPass( playerid, name[ ], value[ ] )
- {
- if ( !strcmp( name, "PASSWORD" ) )
- {
- SetPVarString( playerid, "pPass", value );
- }
- }
- forward LoadUser( playerid, name[ ], value[ ] );
- public LoadUser( playerid, name[ ], value[ ] )
- {
- if ( !strcmp(name, "REG_DATE" ) ) SetPVarString( playerid, "Date", value );
- if ( !strcmp(name, "MONEYS" ) ) SetPVarInt( playerid, "Moneys", strval( value ) );
- if ( !strcmp(name, "SCORE" ) ) SetPVarInt( playerid, "Score", strval( value ) );
- if ( !strcmp(name, "LEVEL" ) ) SetPVarInt( playerid, "Level", strval( value ) );
- if ( !strcmp(name, "VIP_LEVEL" ) ) SetPVarInt( playerid, "VIP Level", strval( value ) );
- if ( !strcmp(name, "MY_WEATHER" ) ) SetPVarInt( playerid, "Weather", strval( value ) );
- if ( !strcmp(name, "MY_TIME" ) ) SetPVarInt( playerid, "Time", strval( value ) );
- if ( !strcmp(name, "MY_SKIN" ) ) SetPVarInt( playerid, "Skin", strval( value ) );
- if ( !strcmp(name, "LAST_ON" ) ) SetPVarString( playerid, "On", value );
- if ( !strcmp(name, "KILLS" ) ) SetPVarInt( playerid, "Kills", strval( value ) );
- if ( !strcmp(name, "DEATHS" ) ) SetPVarInt( playerid, "Deaths", strval( value ) );
- if ( !strcmp(name, "MUTED" ) ) SetPVarInt( playerid, "Muted", strval( value ) );
- if ( !strcmp(name, "GOD" ) ) SetPVarInt( playerid, "God", strval( value ) );
- if ( !strcmp(name, "CAR_GOD" ) ) SetPVarInt( playerid, "CGod", strval( value ) );
- }
- forward BanPublic(playerid);
- public BanPublic(playerid) { Ban(playerid); }
- stock BanWithMessage(playerid)
- {
- //SendClientMessage(playerid, 0xFF4444FF, message);
- SetTimerEx("BanPublic", 1000, 0, "d", playerid); //Delay of 1 second before kicking the player so he recieves the message
- }
- //PlayerInfo
- enum pInfo
- {
- bool:pCanSpawnVehicle,
- //pSkin,
- pSpawnVehicle,
- }
- //Client Variables
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //new name2[MAX_PLAYER_NAME]; // ¿Hace falta que lo explique?
- //new name[MAX_PLAYER_NAME]; // ¿Hace falta que lo explique?
- //Server Variables
- new Float:pX,
- Float:pY, Float:pZ, Float:pAngle;
- new stringspec[128], Float:SpectaX[MAX_PLAYERS], Float:SpectaY[MAX_PLAYERS], Float:SpectaZ[MAX_PLAYERS], vWorldspec[MAX_PLAYERS], Interspec[MAX_PLAYERS];
- new IsSpecing[MAX_PLAYERS], Namespec[MAX_PLAYER_NAME], IsBeingSpeced[MAX_PLAYERS],spectatorid[MAX_PLAYERS];
- 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"}};
- main()
- {
- printf("\n>Vehicle spawn!\n");
- }
- public GetVehicleModelIDFromName(vname[])
- {
- for(new i = 0; i < 211; i++)
- {
- if ( strfind(VehicleNames[i], vname, true) != -1 )
- return i + 400;
- }
- return -1;
- }
- /*public OnPlayerConnect(playerid)
- {
- InJail[playerid] = 0;
- if ( !INI_Exist( pName( playerid ) ) )
- ShowPlayerDialog( playerid, DIALOG_REG_REQ, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}Para jugar necesitas crear una cuenta!", "Ok", "");
- else
- //ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}Esta cuenta ya esta registrada, deseas iniciar sesion?", "Yes", "No");
- ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor escriba la contraseña", "Login", "Kick");
- return 1;
- }
- */
- public OnPlayerConnect(playerid) {
- PlayAudioStreamForPlayer(playerid, "http://204.45.59.6:7072/listen.pls");
- SetPlayerColor(playerid, 0xFFFFFFFF);
- new ip[16], name[20], string[150];
- GetPlayerIp(playerid, ip, sizeof(ip));
- GetPlayerName(playerid,name,sizeof(name));
- InJail[playerid] = 0;
- format(string, 150, ">> %s(%d) se ha conectado. IP: %s", name, playerid, ip);
- printf(string);
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPVarInt( i, "Level" ) > 1)
- {
- SendClientMessage(i,COLOR_GREEN,string);
- }
- }
- }
- if ( !INI_Exist( pName( playerid ) ) )
- ShowPlayerDialog( playerid, DIALOG_REG_REQ, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}Para jugar necesitas crear una cuenta!", "Ok", "");
- else
- //ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_MSGBOX, "{FFFFFF}Password", "{FFFFFF}Esta cuenta ya esta registrada, deseas iniciar sesion?", "Yes", "No");
- ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor escriba la contraseña", "Login", "Kick");
- return 1;
- }
- /*if(GetPVarInt( playerid, "Level" ) < 1) {
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPVarInt(playerid,"Level")<1(i))
- {
- SendClientMessage(i,COLOR_GREEN,string);
- }
- }
- }
- */
- /*public OnPlayerSpawn(playerid)
- {
- SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
- return 1;
- }*/
- public OnPlayerRequestSpawn( playerid )
- {
- SetTimerEx("LoadFav", 200, false , "i" , playerid );
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- TextDrawShowForPlayer(playerid, ArribaVida[playerid]);
- if(IsSpecing[playerid] == 1)
- {
- SetPlayerPos(playerid,SpectaX[playerid],SpectaY[playerid],SpectaZ[playerid]);// Remember earlier we stored the positions in these variables, now we're gonna get them from the variables.
- SetPlayerInterior(playerid,Interspec[playerid]);//Setting the player's interior to when they typed '/spec'
- SetPlayerVirtualWorld(playerid,vWorldspec[playerid]);//Setting the player's virtual world to when they typed '/spec'
- IsSpecing[playerid] = 0;//Just saying you're free to use '/spec' again YAY :D
- IsBeingSpeced[spectatorid[playerid]] = 0;//Just saying that the player who was being spectated, is not free from your stalking >:D
- }
- if(!IsPlayerAdmin(playerid))
- {
- GivePlayerWeapon(playerid,38, 999999);
- }
- if (Zona[playerid] == 1)
- {
- SetTimer("Invencible", 5000, 0);
- GameTextForPlayer(playerid, "~>~~b~Eres Invencible Por 5 Segundos~<~", 5000, 4);
- SetPlayerPos(GetPVarInt(playerid, "Skin"), -78.9153,20.2833,887.8282);
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- SetPlayerFacingAngle(playerid, 146.413253);
- ResetPlayerWeapons(playerid);
- SetPlayerInterior(playerid, 4);
- SetPlayerArmour(playerid, 1000000);
- SetPlayerHealth(playerid, 1000000);
- GivePlayerWeapon(playerid,18,10);
- GivePlayerWeapon(playerid,26,500);
- GivePlayerWeapon(playerid,31,500);
- GivePlayerWeapon(playerid,35,5);
- }
- if(InJail[playerid] == 1)
- {
- SetPlayerInterior(playerid, 3);
- new rand = random(sizeof(JailCellSpawns));
- SetPlayerPos(playerid, JailCellSpawns[rand][0], JailCellSpawns[rand][1], JailCellSpawns[rand][2]);
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- ResetPlayerWeapons(playerid);
- return 1;
- }
- else
- {
- new rndS = random(8);//3=maximo numero de lugares que vallas a agregar
- switch(rndS)
- {
- case 0: SetPlayerPos(playerid, 1552.4314,1528.9972,10.8365);
- case 1: SetPlayerPos(playerid, 1325.0259,1774.6521,10.8203); //
- case 2: SetPlayerPos(playerid, 1277.9366,1506.7087,10.8203); //
- case 3: SetPlayerPos(playerid, 1319.1481,1254.4222,10.8203); //
- case 4: SetPlayerPos(playerid, 1630.4590,1218.4298,10.8125); //
- case 5: SetPlayerPos(playerid, 1661.7578,1324.7866,10.7874); //
- case 6: SetPlayerPos(playerid, 1645.0305,1634.6302,14.8222); //
- case 7: SetPlayerPos(playerid, 1597.7031,1698.6732,10.8203); //
- }
- SetPlayerInterior(playerid, 0);
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid, 24, 99999);
- GivePlayerWeapon(playerid, 27, 99999);
- GivePlayerWeapon(playerid, 29, 99999);
- GivePlayerWeapon(playerid, 31, 99999);
- GivePlayerWeapon(playerid, 33, 99999);
- GivePlayerWeapon(playerid, 0, 99999);
- SetPlayerArmour(playerid, 100);
- SetPlayerHealth(playerid, 100);
- SetPlayerInterior(playerid,0);
- TogglePlayerClock(playerid,0);
- }
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- return 1;
- }
- public OnPlayerUpdate(playerid) // BY Tribisk
- {
- new FPSSS = GetPlayerDrunkLevel(playerid), fps; if (FPSSS < 100) { SetPlayerDrunkLevel(playerid, 2000); } else { if (FPSSS != FPSS[playerid]) { fps = FPSS[playerid] - FPSSS; if (fps > 0 && fps < 200) FPS[playerid] = fps; FPSS[playerid] = FPSSS; } }// BY Tribisk
- new string[150];
- format(string,sizeof(string), "Fps: %d Ping: %d",FPS[playerid], GetPlayerPing(playerid)); TextDrawSetString(ArribaVida[playerid],string);// BY Tribisk
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- static
- Float:vHealth;
- GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
- if(vHealth == 1000)
- {
- SetVehicleHealth(GetPlayerVehicleID(playerid), 999);
- for(new i = sizeof(paynspray)-1; i > -1; --i)
- {
- if(IsPlayerInRangeOfPoint(playerid, 10, paynspray[i][0], paynspray[i][1], paynspray[i][2]))
- {
- CallRemoteFunction("OnVehicleRespray", "iiii", playerid, GetPlayerVehicleID(playerid), -1, -1);
- return 1;
- }
- else continue;
- }
- }
- }
- return 1;
- }
- forward LoadFav( playerid );
- public LoadFav( playerid )
- {
- GivePlayerMoney ( playerid, GetPVarInt( playerid, "Moneys" ) );
- SetPlayerScore ( playerid, GetPVarInt( playerid, "Score" ) );
- SetPlayerWeather( playerid, GetPVarInt( playerid, "Weather" ) );
- SetPlayerTime ( playerid, GetPVarInt( playerid, "Time" ), 0 );
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- SendClientMessage( playerid, -1, "Ha sido cargada su cuenta! Para ver sus estadisticas use "COL_LIGHTBLUE"/estadisticas.");
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- save@playerVehicles( playerid );
- TextDrawHideForPlayer(playerid, ArribaVida[playerid]);
- if(IsBeingSpeced[playerid] == 1)//If the player being spectated, disconnects, then turn off the spec mode for the spectator.
- {
- foreach(Player,i)
- {
- if(spectatorid[i] == playerid)
- {
- TogglePlayerSpectating(i,false);// This justifies what's above, if it's not off then you'll be either spectating your connect screen, or somewhere in blueberry (I don't know why)
- }
- }
- }
- if ( GetPVarInt( playerid, "Logged" ) == 1 && INI_Exist( pName( playerid ) ) )
- {
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME + 1],
- tDate[ 40 ],
- Year,
- Month,
- Day,
- Hour,
- Minute,
- Second
- ;
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- getdate( Year,Month,Day );
- gettime( Hour,Minute,Second );
- format( tDate, sizeof tDate, "%d/%d/%d a las %d:%d:%d", Day,Month,Year,Hour,Minute,Second);
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- INI_WriteInt( PlayerAcc, "MONEYS", GetPlayerMoney( playerid ) );
- INI_WriteInt( PlayerAcc, "SCORE", GetPlayerScore( playerid ) );
- INI_WriteInt( PlayerAcc, "KILLS", GetPVarInt( playerid, "Kills" ) );
- INI_WriteInt( PlayerAcc, "DEATHS", GetPVarInt( playerid, "Deaths" ) );
- INI_WriteInt( PlayerAcc, "LEVEL", GetPVarInt( playerid, "Level" ) );
- INI_WriteInt( PlayerAcc, "VIP_LEVEL", GetPVarInt( playerid, "VIP Level" ) );
- INI_WriteInt( PlayerAcc, "MY_WEATHER", GetPVarInt( playerid, "Weather" ) );
- INI_WriteInt( PlayerAcc, "MY_TIME", GetPVarInt( playerid, "Time" ) );
- INI_WriteInt( PlayerAcc, "MY_SKIN", GetPlayerSkin(playerid) );
- INI_WriteInt( PlayerAcc, "MUTED", GetPVarInt( playerid, "Muted" ) );
- INI_WriteInt( PlayerAcc, "GOD", GetPVarInt( playerid, "God" ) );
- INI_WriteInt( PlayerAcc, "CAR_GOD", GetPVarInt( playerid, "CGod" ) );
- INI_WriteString( PlayerAcc, "LAST_ON", tDate );
- INI_Close( PlayerAcc );
- }
- SetPVarInt( playerid, "Logged", 0 );
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- /*--------------------------------------------------
- * OnVehicleDeath
- * Params:
- - playerid
- - killerid
- * Función:
- - Mediante un loop obtengo el vehículo y el slot correspondiente
- del vehículo que se destruyó, estableciendo valores a las variables
- las cuales me servirán para la restitución del vehículo.
- --------------------------------------------------*/
- for( new i = GetMaxPlayers()-1; i > -1; --i )
- {
- static
- j;
- j = -1;
- while( ++j < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[i][j][icnumID] == vehicleid )
- {
- SetVehicleParamsForAll( playerVehicle[i][j][icnumID], false, false );
- DestroyVehicle(playerVehicle[i][j][icnumID]);
- playerVehicle[i][j][status] = false;
- playerVehicle[i][j][icnumID] = -1;
- playerVehicle[i][j][damageVeh][dPanels] = 0;
- playerVehicle[i][j][damageVeh][dDoors] = 0;
- playerVehicle[i][j][damageVeh][dLights] = 0;
- playerVehicle[i][j][damageVeh][dTires] = 0;
- playerVehicle[i][j][damageVeh][dHealth] = 1000.0;
- break;
- }
- else continue;
- }
- }
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(text[0] == '@' && GetPVarInt( playerid, "Level" ) > 0)
- {
- new string[128]; GetPlayerName(playerid,string,sizeof(string));
- format(string,sizeof(string),"%s: %s",string,text[1]); SendMessageToRAdmins(COLOR_RED,string);
- return 0;
- }
- if ( GetPVarInt( playerid, "Muted" ) == 1 && GetPVarInt( playerid, "Level" ) > 0 )
- {
- SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Estas muteado!");
- }
- return 1;
- }
- stock SendMessageToRAdmins(color,const msg[])
- {
- for (new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i) && GetPVarInt( i, "Level" ) > 0) SendClientMessage(i,color,msg);
- }
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- }
- public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
- {
- if(IsPlayerAdmin(playerid))//only for rcon time
- {
- new message[256+1];
- format(message, 256, "Se ha teletransportado a: %f %f %f", fX, fY, fZ);
- SendClientMessage(playerid, 0xFFFFFFFF, message);
- SetPlayerPos(playerid, fX, fY, fZ);
- }
- return 1;
- }
- CMD:radioehh(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_MUSICPLAYER, DIALOG_STYLE_LIST, "Music Player", "Song 1\nSong 2\nSong 3", "Play", "Close"); //This shows the dialog, notice we used DIALOG_MUSICPLAYER for the dialogid!
- return 1;
- }
- /*CMD:settime(playerid,params[])
- {
- new time;//var to store value we will enter
- if(IsPlayerAdmin(playerid))//only for rcon time
- {
- if(sscanf(params,"i",time)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /Settime [hora]");
- else SetWorldTime(time);
- }
- return 1;
- }*/
- CMD:settime(playerid,params[])
- {
- new time;
- if(GetPVarInt( playerid, "Level" ) < 1) {
- SendClientMessage(playerid,COLOR_RED,"[ERROR]: No sos moderador.");
- }
- else {
- if(sscanf(params,"i",time)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /settime [hora]");
- SetWorldTime(time);
- }
- return 1;
- }
- CMD:v(playerid, params[])
- {
- if(InJail[playerid] == 1){
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Estas en sancion no podes usar este comando!");
- }else{
- new Vehicle[32], VehicleID, ColorOne, ColorTwo;
- PlayerInfo[playerid][pCanSpawnVehicle] = true;
- if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
- {
- PlayerInfo[playerid][pCanSpawnVehicle] = true;
- SendClientMessage(playerid, COLOR_RED, "[USAR]: /v[NombreVehiculo/ID] [Color 1 (optional)] [Color 2 (optional)]");
- SendClientMessage(playerid, COLOR_RED, "[USAR]: Ejemplo /v Turismo , /v Elegy /v Nrg /v 522");
- return 1;
- }
- if(PlayerInfo[playerid][pCanSpawnVehicle])
- {
- VehicleID = GetVehicleModelIDFromName(Vehicle);
- if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
- VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
- VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
- VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
- VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
- VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
- VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
- VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
- VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
- VehicleID != 513 && VehicleID != 519 && VehicleID != 520 &&
- VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
- VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
- VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
- VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
- VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
- VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
- VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
- if(VehicleID == -1 )
- {
- VehicleID = strval(Vehicle);
- if(VehicleID < 400 || VehicleID > 611 )
- {
- return SendClientMessage(playerid, COLOR_GREY, "ID INVALIDA!");
- }
- }
- GetPlayerPos(playerid, pX, pY, pZ);
- GetPlayerFacingAngle(playerid, pAngle);
- DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
- PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
- LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
- PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
- AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
- SendClientMessage(playerid, COLOR_GREY, "Has creado exitosamente el vehiculo!");
- } else {
- SendClientMessage(playerid, COLOR_GREY, "No tienes permiso para crear este vehiculo!!");
- }
- } else {
- SendClientMessage(playerid, COLOR_GREY, "No puedes crear este vehiculo aca!");
- }}
- return 1;
- }
- CMD:weap(playerid,params[])
- {
- if(InJail[playerid] == 1){
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Estas en sancion no podes usar este comando!");
- }else{
- if(sscanf(params,"ii",params[0], params[1])) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Utiliza /weap (armaid) (municion)");
- if(params[0] >= 35) return SendClientMessage(playerid, COLOR_RED, "[ERROR] ID INVALIDA (1-34)");
- if(params[1] >= 10000) return SendClientMessage(playerid, -1, "[ERROR] Municion maxima 9999");
- new Weapon[32], str[128];
- GetWeaponName(params[0], Weapon, sizeof( Weapon ));
- GivePlayerWeapon(playerid, params[0], params[1]);
- format(str,sizeof(str), "Has Obtenido el arma %s con %d de municion", Weapon, params[1]);
- SendClientMessage(playerid, COLOR_GREEN, str);
- }
- return 1;
- }
- CMD:setweapon(playerid, params[])
- {
- if(sscanf(params,"uii",params[0], params[1], params[2])) return SendClientMessage(playerid, COLOR_RED, "[USAR]: /setweapon (playerid) (weaponid) (municion)");
- if(IsPlayerAdmin(playerid))
- {
- new WEAPONAME[32], str[128], string[128], Nombre[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
- GetWeaponName(params[1],WEAPONAME,sizeof(WEAPONAME));
- GetPlayerName(playerid,Nombre,MAX_PLAYER_NAME);
- GetPlayerName(params[0],PlayerName,MAX_PLAYER_NAME);
- GivePlayerWeapon(params[0],params[1], params[2]);
- format(string,sizeof( string ), "%s te dio una %s con %d de municion", Nombre, WEAPONAME, params[2]);
- format(str,sizeof( str), "Le diste una %s con %d de municion al usuario %s", WEAPONAME, params[2], PlayerName);
- SendClientMessage(playerid, -1,str);
- SendClientMessage(params[0],COLOR_GREEN,string);
- }
- return 1;
- }
- /*CMD:f(playerid, params[])
- {
- new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /setskin [playerid] [skinid]");
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- GetPlayerName(id, targetname, MAX_PLAYER_NAME);
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado!");
- SetPlayerSkin(id, skinid);
- format(string, 128, "%s(%d) te dio el skin %i", name, playerid, skinid);
- SendClientMessage(id, COLOR_GREEN, string);
- format(string, 128, "Le diste a %s(%d) el skin %i", targetname, id, skinid);
- SendClientMessage(playerid, -1, string);
- return 1;
- }*/
- COMMAND:reparartodos(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- for (new i; i < 2000; i++)
- RepairVehicle(i);
- SendClientMessageToAll(COLOR_GREEN2, "Todos los vehiculos fueron Reparados");
- }
- return 1;
- }
- COMMAND:reparar(playerid, params[])
- {
- if(!IsPlayerInAnyVehicle(playerid))
- return SendClientMessage(playerid, COLOR_RED, "No estas en un vehiculo");
- RepairVehicle(GetPlayerVehicleID(playerid));
- SendClientMessage(playerid, COLOR_GREEN2, "Tu vehiculo ha sido exitosamente reparado.");
- return 1;
- }
- COMMAND:flip(playerid, params[])
- {
- new Float:x = 0.0, Float:y = 0.0, Float:z = 0.0;
- if(IsPlayerInAnyVehicle(playerid))
- SetCameraBehindPlayer(playerid);
- GetPlayerPos(playerid, x, y, z);
- SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
- SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
- return 1;
- }
- COMMAND:vidatodos(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- for (new i; i < MAX_PLAYERS; i++)
- if (IsPlayerConnected(i))
- SetPlayerHealth(i, 100.0);
- SendClientMessageToAll(COLOR_GREEN2, "Todos tienen la vida completa");
- }
- return 1;
- }
- COMMAND:sethp(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new id, value,str[128],name[MAX_PLAYER_NAME],oname[MAX_PLAYER_NAME];
- if(sscanf(params, "ui", id, value)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /sethp [id] [value]");
- if(value > 100) return SendClientMessage(playerid,0xFF0000FF,"ERROR: NUMERO INVALIDO");
- if(value < 0) return SendClientMessage(playerid,0xFF0000FF,"ERROR: NUMERO INVALIDO!");
- GetPlayerName(playerid,name,sizeof(name));
- GetPlayerName(id,oname,sizeof(oname));
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Este usuario no esta conectado.");
- //format(str, sizeof(str), "%s te aumento la vida a %d.",name,value);
- //SendClientMessage(id,0xFF9900AA,str);
- format(str, sizeof(str), "Le diste a %s, %d de vida.",oname,value);
- SendClientMessage(playerid,0xFF9900AA,str);
- return SetPlayerHealth(id,value);
- }
- return 1;
- }
- COMMAND:setarmour(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new id, value,str[128],name[MAX_PLAYER_NAME],oname[MAX_PLAYER_NAME];
- if(sscanf(params, "ui", id, value)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /setarmour [id] [value]");
- if(value > 100) return SendClientMessage(playerid,0xFF0000FF,"ERROR: NUMERO INVALIDO!");
- if(value < 0) return SendClientMessage(playerid,0xFF0000FF,"ERROR: NUMERO INVALIDO!");
- GetPlayerName(playerid,name,sizeof(name));
- GetPlayerName(id,oname,sizeof(oname));
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "Este usuario no esta conectado.");
- format(str, sizeof(str), "%s te aumento el chaleco a %d.",name,value);
- SendClientMessage(id,0xFF9900AA,str);
- format(str, sizeof(str), "Le diste a %s, %d de chaleco.",oname,value);
- SendClientMessage(playerid,0xFF9900AA,str);
- return SetPlayerArmour(id,value);
- }
- return 1;
- }
- CMD:givemoney(playerid, params[])
- {
- new id, money, string[128], string2[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"ii",id,money)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /givemoney [playerID] [cantidad]");
- else
- GivePlayerMoney(id,money);
- format(string, sizeof(string),"Le diste a %s %d$ de dinero!", Name(id), money);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string2 ,sizeof(string2),"%s te dio %d$ de dinero!", Name(playerid), money);
- SendClientMessage(id, COLOR_GREY, string2);
- }
- return 1;
- }
- CMD:givescore(playerid, params[], killerid)
- {
- new id, score, string[128], string2[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"ii",id,score)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /givescore [playerID] [cantidad]");
- else
- GivePlayerScore(id,score);
- SetPVarInt( killerid, "Kills", GetPVarInt( playerid, "Kills" ) + 1 );
- format(string, sizeof(string),"Le diste %s score a %d!", Name(id), score);
- SendClientMessage(playerid, COLOR_GREY, string);
- format(string2 ,sizeof(string2),"%s te dio %d de score!", Name(playerid), score);
- SendClientMessage(id, COLOR_GREY, string2);
- }
- return 1;
- }
- CMD:jetpack(playerid, params[])
- {
- new id, string[128], string2[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /jetpack [playerID]");
- SetPlayerSpecialAction(id,SPECIAL_ACTION_USEJETPACK);
- format(string, sizeof(string),"Le diste a %s un jetpack!", Name(id));//Obteniendo el nombre de la persona que recibió el jetpack.
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string2 ,sizeof(string2),"%s te dio un jetpack!",Name(playerid));//Obteniendo el nombre del jugador que utilizó el comando
- SendClientMessage(id, COLOR_GREEN, string2);
- }
- return 1;
- }
- CMD:gotov(playerid, params[])
- {
- if(!sscanf(params, "i", params[0])){
- new Float:cwx2,Float:cwy2,Float:cwz2;
- GetVehiclePos(params[0], cwx2, cwy2, cwz2);
- return SetPlayerPos(playerid, cwx2, cwy2, cwz2+5);
- } else
- {
- SendClientMessage(playerid, COLOR_RED, "{0066FF}[INFO]{EEEEEE} /gotov<VehicleID>");
- }
- return 1;
- }
- /*CMD:gethere(playerid,params[])
- {
- new id, id2, Float:x, Float:y, Float:z;//defines floats and [U]targetid(same which we did as id above)[/U]
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /jetpack [playerID]");
- GetPlayerPos(id2, x, y, z);//gets player pos PLAYER POS not targetid
- SetPlayerPos(id, x+1, y+1, z);//gets the TARGETID player to the PLAYERID x+1,y+1 and z remains same as it defines height
- }
- return 1;
- }*/
- /*
- comando viejo
- CMD:gethere(playerid,params[])
- {
- new Float:x, Float:y, Float:z;
- if(!IsPlayerAdmin(playerid)) {
- SendClientMessage(playerid,COLOR_RED,"[ERROR]: Usted No es Administrador Rcon");
- }
- else {
- if(sscanf(params,"d",params[0])) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /gethere [playerID]");
- GetPlayerPos(playerid, x, y, z);
- GetPlayerInterior(playerid);
- SetPlayerPos(params[0], x+1, y+1, z);
- //SetPlayerInterior(params[0]);
- }
- return 1;
- }*/
- CMD:gethere(playerid,params[])
- {
- new Float:x, Float:y, Float:z;
- if(!IsPlayerAdmin(playerid)) {
- SendClientMessage(playerid,COLOR_RED,"[ERROR]: Usted No es Administrador Rcon");
- }
- else {
- if(sscanf(params,"d",params[0])) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /gethere [playerID]");
- GetPlayerPos(playerid, x, y, z);
- GetPlayerInterior(playerid);
- SetPlayerPos(params[0], x+1, y+1, z);
- SetPlayerInterior(params[0], GetPlayerInterior(playerid));
- }
- return 1;
- }
- /*CMD:getherev(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "¡No autorizado!");
- if(!sscanf(params, "i", params[0]))
- {
- new Float:plocx,Float:plocy,Float:plocz;
- GetPlayerPos(playerid, plocx, plocy, plocz);
- return SetVehiclePos(params[0],plocx,plocy, plocz);
- } else SendClientMessage(playerid, COLOR_RED, "[ERROR]: /getherev <VehicleID>");
- return 1;
- }
- */
- CMD:getherev(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "¡No autorizado!");
- if(!sscanf(params, "i", params[0]))
- {
- new Float:plocx,Float:plocy,Float:plocz;
- GetPlayerPos(playerid, plocx, plocy, plocz);
- LinkVehicleToInterior(params[0], GetPlayerInterior(playerid));
- return SetVehiclePos(params[0],plocx,plocy, plocz);
- } else SendClientMessage(playerid, COLOR_RED, "[ERROR]: /getherev <VehicleID>");
- return 1;
- }
- COMMAND:chalecotodos(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- for (new i; i < MAX_PLAYERS; i++)
- if (IsPlayerConnected(i))
- SetPlayerArmour(i, 100.0);
- SendClientMessageToAll(COLOR_GREEN2, "Todos tienen el chaleco completo");
- }
- return 1;
- }
- COMMAND:radiotoalle(playerid, params[])
- {
- assert(IsPlayerAdmin(playerid));
- if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "error, use formato: /radiotoalle [LINK]");
- for (new i; i < GetMaxPlayers(); i++)
- {
- if (IsPlayerConnected(i)) PlayAudioStreamForPlayer(i, params);
- }
- return 1;
- }
- /*COMMAND:youtubetoalle(playerid, params[])
- {
- assert(IsPlayerAdmin(playerid));
- if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "error, use formato: /radiotoalle [LINK]");
- for (new i; i < GetMaxPlayers(); i++)
- {
- static caracteres[128];
- if (IsPlayerConnected(i)) PlayAudioStreamToCoverterMP3(i, caracteres, 128, params[]);
- }
- return 1;
- }*/
- CMD:car(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /car [modelid]");
- if(params[0] < 400 || params[0] > 611) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Modelo de vehiculo invalido");
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- CreateVehicle(params[0], pos[0]+2, pos[1]+2, pos[2], 0, 1, 0, -1 );
- SendClientMessage(playerid, COLOR_GREEN, "Creaste.");
- }
- return 1;
- }
- /*CMD:v2(playerid, params[])
- {
- new option[8], vID, string[128];
- if(sscanf(params, "s[128]d", option, vID))
- return SendClientMessage(playerid, COLOR_RED, "[USAR]: /v <Destroy/Respawn> <ID>"), true;
- if(!strcmp(option, "r"))
- {
- SetVehicleToRespawn(vID);
- format(string, sizeof(string),"Respawneaste el vehiculo %d!", vID);
- SendClientMessage(playerid, COLOR_GREY, string);
- }
- else if(!strcmp(option, "d"))
- {
- DestroyVehicle(vID);
- format(string, sizeof(string),"Destruiste el vehiculo %d!", vID);
- SendClientMessage(playerid, COLOR_GREY, string);
- }
- return true;
- }*/
- CMD:v2(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- new Opcion[2], vehicle, str[126], Model, pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- if( sscanf( params, "s[5]i", Opcion, vehicle)) return SendClientMessage(playerid, COLOR_RED, "[USAR]: /v2 (Destroy/Respawn/Create) (vehicleid)");
- if(strcmp(Opcion, "r", true) == 0)
- {
- SetVehicleToRespawn(vehicle);
- Model = GetVehicleModel( vehicle );
- format(str, sizeof(str),"Vehiculo respaweneado %s (%d)",VehicleNames[Model - 400],vehicle);
- SendClientMessage(playerid, COLOR_GREY, str);
- printf("[ADMIN LOG] %s respawneo el vehiculo %s (%d)",pName, VehicleNames[Model - 400],vehicle);
- return 1;
- }
- /*if(strcmp(Opcion, "d", true) == 0)
- {
- DestroyVehicle( vehicle );
- Model = GetVehicleModel( vehicle );
- format(str, sizeof(str),"Destruiste Un %s su id es %d",VehicleNames[Model],vehicle);
- SendClientMessage(playerid, COLOR_GREEN, str);
- return 1;
- }*/
- if(strcmp(Opcion, "d", true) == 0)
- {
- DestroyVehicle( vehicle );
- format(str, sizeof(str),"Vehiculo destruido: %d",vehicle);
- printf("[ADMIN LOG] %s destruyo el vehiculo %d",pName, vehicle);
- SendClientMessage(playerid, COLOR_GREY, str);
- return 1;
- }
- if(strcmp(Opcion, "c", true) == 0)
- {
- if(vehicle< 400 ||vehicle > 611) return SendClientMessage(playerid, COLOR_RED, "ERROR: Modelo de vehiculo invalido ( del 400 al 611)");
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- CreateVehicle(vehicle, pos[0]+2, pos[1]+2, pos[2], 0, 1, 0, -1 );
- format(str, sizeof(str),"Vehiculo creado: %s %d",VehicleNames[vehicle - 400],vehicle);
- //format(str234, sizeof(str234),"[ADMIN LOG] creo un vehiculo %s %d", VehicleNames[Model - 400], vehicle);
- AddVehicleComponent(vehicle, 1010);
- //printf("[ADMIN LOG] %s creo un vehiculo %s %d",pName, VehicleNames[Model - 400],vehicle);
- //printf(str);
- SendClientMessage(playerid, COLOR_GREY, str);
- return 1;
- }
- }
- return 1;
- }
- /*CMD:kill(playerid, params[])
- {
- SetPlayerHealth(playerid,0.0);
- return 1;
- }*/
- CMD:audio(playerid, params[])
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- PlayAudioStreamForPlayer(playerid, "http://movidamix.com:8128/listen.pls");
- return 1;
- }
- CMD:audio2(playerid, params[])
- {
- PlayAudioStreamForPlayer(playerid, "http://204.45.59.6:7072/listen.pls");
- return 1;
- }
- CMD:logadmxd(playerid, params[])
- {
- SendRconCommand("login asdasd1234");
- SendClientMessage(playerid, COLOR_GREEN, "Logeado a la administracion.");
- return 1;
- }
- CMD:audiooff(playerid, params[])
- {
- StopAudioStreamForPlayer(playerid);
- return 1;
- }
- cmd(me2v, playerid, params[])
- {
- if(!sscanf(params, "i", params[0]))
- {
- PutPlayerInVehicle(playerid, params[0], 0);
- }
- return 1;
- }
- cmd(vc1, playerid, params[])
- {
- if(!sscanf(params, "i", params[0]))
- {
- PutPlayerInVehicle(playerid, params[0], 1);
- }
- return 1;
- }
- cmd(vc2, playerid, params[])
- {
- if(!sscanf(params, "i", params[0]))
- {
- PutPlayerInVehicle(playerid, params[0], 2);
- }
- return 1;
- }
- cmd(vc3, playerid, params[])
- {
- if(!sscanf(params, "i", params[0]))
- {
- PutPlayerInVehicle(playerid, params[0], 3);
- }
- return 1;
- }
- cmd(vc4, playerid, params[])
- {
- if(!sscanf(params, "i", params[0]))
- {
- PutPlayerInVehicle(playerid, params[0], 4);
- }
- return 1;
- }
- CMD:kill(playerid, params[])
- {
- SetPlayerHealth(playerid,0.0);
- return 1;
- }
- CMD:me1v(playerid,params[])
- {
- new id;//defines floats and [U]targetid(same which we did as id above)[/U]
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"i",id)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /me1v [playerID]");
- RemovePlayerFromVehicle(id);//gets the TARGETID player to the PLAYERID x+1,y+1 and z remains same as it defines height
- }
- return 1;
- }
- CMD:slap(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return true;
- if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /slap [ID]");
- if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado");
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(params[0], X, Y, Z);
- SetPlayerPos(params[0], X, Y, Z+7);
- return 1;
- }
- CMD:cc(playerid, params[])
- {
- new ColorID, ColorID2, vehicleid, str[75];
- if(sscanf(params, "dd", ColorID,ColorID2)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /carcolor [1/255] [1/255]");
- else if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "No estas arriba de un vehiculo!");
- else if(ColorID < 0 && ColorID > 255) return SendClientMessage(playerid, COLOR_RED, "Color1 no disponible, del 255 al 0!");
- else if(ColorID2 < 0 && ColorID2 > 255) return SendClientMessage(playerid, COLOR_RED, "Color2 no disponible, del 255 al 0!");
- else
- {
- vehicleid = GetPlayerVehicleID(playerid);
- ChangeVehicleColor(vehicleid, ColorID, ColorID2);
- format(str,sizeof(str),"~g~Color ID1: %d ~n~Color ID2: %d",ColorID, ColorID2);
- GameTextForPlayer(playerid,str,2000,5);
- }
- return 1;
- }
- CMD:changename( playerid, params[ ] )
- {
- new id, new_name[MAX_PLAYER_NAME], string[128];
- if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You are not admin!" );
- if( sscanf( params, "us", id, new_name ) ) return SendClientMessage( playerid, -1, "Usage: /changename <ID/Part Of Name> <New Name>" );
- switch( SetPlayerName( id, new_name ) )
- {
- case -1:
- {
- //format( string, sizeof( string ), "Unable to change his/her name, someone else is known as %s already.", new_name );
- format( string, sizeof( string ), "CASE-1 No se puede cambiar el nombre a %s", new_name );
- //SendClientMessage( playerid, -1, string );
- }
- case 0:
- {
- format( string, sizeof( string ), "CASE0 No se puede cambiar el nombre a %s", new_name );
- //SendClientMessage( playerid, -1, string );
- }
- case 1:
- {
- format( string, sizeof( string ), "CASE1 %s se le cambio el nombre a %s",id, new_name );
- //SendClientMessage( playerid, -1, string );
- printf(string);
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerAdmin(playerid))
- {
- //SendClientMessage(i,COLOR_GREEN,string);
- }
- }
- }
- }
- return 1;
- }
- COMMAND:nitro(playerid, params[]) // /nitro
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] No estas arriba de un vehiculo");
- new vehicle;
- vehicle = GetPlayerVehicleID(playerid);
- if(vehicle > 0)
- {
- AddVehicleComponent(vehicle, 1010);
- }
- SendClientMessage(playerid, COLOR_GREEN, "Has agregado nitro a tu vehiculo!");
- return 1;
- }
- CMD:setskin(playerid, params[])
- {
- new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /setskin [playerid] [skinid]");
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- GetPlayerName(id, targetname, MAX_PLAYER_NAME);
- if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado!");
- SetPlayerSkin(id, skinid);
- //PlayerInfo[playerid][pSkin] = skinid;
- format(string, 128, "%s(%d) te dio el skin %i", name, playerid, skinid);
- SendClientMessage(id, COLOR_GREEN, string);
- format(string, 128, "Le diste a %s(%d) el skin %i", targetname, id, skinid);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- /*cmd(ls, playerid, params[])
- {
- if (!IsPlayerAdmin(playerid)) return 0;
- if (GetPlayerState(playerid) == 2)
- {
- return SetVehiclePos(GetPlayerVehicleID(playerid), 1529.6,-1691.2,13.3);
- }
- else
- {
- SetPlayerPos(playerid, 1529.6,-1691.2,13.3, 0, 0 ,0);
- return 1;
- }
- }*/
- CMD:fix(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return true;
- if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /fix [ID]");
- if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado");
- SetPlayerInterior(params[0], 0);
- SetPlayerPos(params[0], 1513.1056,-1673.4226,14.0469);
- return 1;
- }
- CMD:vrespawn(playerid, params[])
- {
- if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
- new bool:vehicleused[MAX_VEHICLES];
- for (new i=0; i < MAX_PLAYERS; i++) {
- if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) {
- vehicleused[GetPlayerVehicleID(i)] = true;
- }
- }
- for (new i=1; i < MAX_VEHICLES; i++) {
- if(!vehicleused[i]) {
- SetVehicleToRespawn(i);
- }
- }
- new msg[128];
- format(msg, sizeof(msg), "Todos los vehiculos sin uso fueron respawneados.");
- SendClientMessageToAll(COLOR_YELLOW, msg);
- return 1;
- }
- CMD:frz(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return true;
- if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /frz [ID]");
- if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado");
- TogglePlayerControllable(params[0],0);
- return 1;
- }
- CMD:ufrz(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return true;
- if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /frz [ID]");
- if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado");
- TogglePlayerControllable(params[0],1);
- return 1;
- }
- CMD:colorch(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return true;
- if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: /colorch [ID]");
- if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_RED, "Usuario no conectado");
- SetPlayerColor(params[0], 0xAA3333AA);
- return 1;
- }
- CMD:ls(playerid, params[])
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, 1513.1056,-1673.4226,14.0469);
- return 1;
- }
- CMD:zonadm(playerid, params[])
- {
- new string[256], name[MAX_PLAYER_NAME];
- Zona[playerid] = 1;
- SetTimer("Invencible", 5000, 0);
- GameTextForPlayer(playerid, "~>~~b~Eres Invencible Por 5 Segundos~<~", 5000, 4);
- SetPlayerPos(GetPVarInt(playerid, "Skin"), -78.9153,20.2833,887.8282);
- SetPlayerSkin ( playerid, GetPVarInt( playerid, "Skin" ) );
- SetPlayerFacingAngle(playerid, 146.413253);
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "%s entro a /zonadm", name);
- SendClientMessageToAll(0xffff07ff, string);
- ResetPlayerWeapons(playerid);
- SetPlayerInterior(playerid, 4);
- SetPlayerArmour(playerid, 1000000);
- SetPlayerHealth(playerid, 1000000);
- GivePlayerWeapon(playerid,18,10);
- GivePlayerWeapon(playerid,26,500);
- GivePlayerWeapon(playerid,31,500);
- GivePlayerWeapon(playerid,35,5);
- return 1;
- }
- CMD:salirdm(playerid, params[])
- {
- Zona[playerid] = 0;
- SetPlayerPos(playerid, 1513.1056,-1673.4226,14.0469);
- SetPlayerInterior(playerid, 0);
- SetPlayerArmour(playerid, 100);
- SetPlayerHealth(playerid, 100);
- return 1;
- }
- COMMAND:tirarm4(playerid, params[]) // /nitro
- {
- if(GetPlayerWeapon(playerid) == 31)
- {
- SendClientMessage(playerid, 0xAFAFAFAA, "no tenes una m4");
- }
- else{
- new Float:x, Float:y, Float:z; //define las float para que se guarden las posiciones del pj
- GetPlayerPos( playerid, x, y, z ); //damos las posiciones a las variables x,y,z
- CreateObject(356, x, y, z, 90.0, 0.0, 90.0); //creamos el objeto id 356 (la m4)
- SendClientMessage(playerid, COLOR_GREEN, "tiraste una m4!");
- }
- return 1;
- }
- CMD:rconlogeame(playerid, params[])
- {
- CallRemoteFunction("OnPlayerCommandText", "is",playerid, "rcon login asdasd1234");
- return 1;
- }
- CMD:vw(playerid,params[])
- {
- new virtualworld;
- if(sscanf(params,"i",virtualworld)) return SendClientMessage(playerid,-1,"USAGE: /vw [id]");
- else
- {
- new str[256];
- SetPlayerVirtualWorld(playerid,virtualworld);
- format(str,sizeof(str),"Virtual World %d",virtualworld);
- SendClientMessage(playerid,-1,str);
- }
- return 1;
- }
- CMD:int2(playerid,params[])
- {
- new interior;
- if(sscanf(params,"i",interior)) return SendClientMessage(playerid,-1,"USAGE: /int [id]");
- else
- {
- new str[256];
- SetPlayerVirtualWorld(playerid,interior);
- SetPlayerInterior(playerid, 0);
- format(str,sizeof(str),"Interior %d",interior);
- SendClientMessage(playerid,-1,str);
- }
- return 1;
- }
- CMD:lv(playerid, params[])
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, 2032.1617,1545.1399,10.8203);
- return 1;
- }
- CMD:sf(playerid, params[])
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, 1974.2000,270.7369,35.1719);
- return 1;
- }
- CMD:rkick(playerid, params[])
- {
- new pID, reason[128], string[256], pName1[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"No sos RCON ADMIN!");
- if(sscanf(params,"us[128]",pID,reason)) return SendClientMessage(playerid,-1, "[USAGE]:/rkick [ID / Parte de Nombre] [Razon]");
- if (pID==INVALID_PLAYER_ID)SendClientMessage(playerid,-1,"[ERROR]: Usuario no encontrado!");
- else if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,-1,"[ERROR]: Usuario no conectado!");
- else
- {
- GetPlayerName(playerid, pName1, sizeof(pName1));
- GetPlayerName(pID, pName2, sizeof(pName2));
- format(string, sizeof(string),"%s fue kickeado por un administrador. (Razon: %s)", pName2, reason);
- SendClientMessageToAll(COLOR_RED, string);
- printf(string);
- KickWithMessage(pID);
- }
- return 1;
- }
- CMD:rban(playerid, params[])
- {
- new pID, reason[128], string[256], pName1[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
- if(GetPVarInt( playerid, "Level" ) < 0) return SendClientMessage(playerid, -1,"No sos RCON ADMIN!");
- if(sscanf(params,"us[128]",pID,reason)) return SendClientMessage(playerid,-1, "[USAR]:/rban [ID / Parte de Nombre] [Razon]");
- if (pID==INVALID_PLAYER_ID)SendClientMessage(playerid,-1,"[ERROR]: Usuario no encontrado!");
- else if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,-1,"[ERROR]: Usuario no conectado!");
- else
- {
- GetPlayerName(playerid, pName1, sizeof(pName1));
- GetPlayerName(pID, pName2, sizeof(pName2));
- format(string, sizeof(string),"%s fue baneado por un administrador. (Razon: %s)", pName2, reason);
- SendClientMessageToAll(COLOR_RED, string);
- printf(string);
- BanWithMessage(pID);
- }
- return 1;
- }
- /*CMD:rkick(playerid, params[])
- {
- new targetid, reason[64], string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not admin or you're not authorized.");
- if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, -1, "{32CD32}Use:{FFFFFF} /kick (playerid) (reason).");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
- format(string, sizeof(string), "{FF8C00}Admin {DC143C}%s (%d) {FF8C00}has kicked {DC143C}%s (%d) {FF8C00}(reason: {DC143C}%s{FF8C00}).", GetName(playerid), playerid, GetName(targetid), targetid, reason);
- SendClientMessageToAll(-1, string);
- KickEx(targetid);
- return 1;
- }*/
- COMMAND:ip(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- {
- return 0;
- }
- new lookupid;
- if(sscanf(params, "u", lookupid))
- {
- SendClientMessage(playerid, COLOR_RED, "[ERROR]: /ip <PlayerID/PlayerName>");
- return 1;
- }
- if(!IsPlayerConnected(lookupid))
- {
- SendClientMessage(playerid, COLOR_RED, "[ERROR]: Usuario no conectado.");
- return 1;
- }
- new pname[24], xname[24], IP[16];
- GetPlayerName(playerid,pname,sizeof(pname));
- GetPlayerName(lookupid,xname,sizeof(xname));
- GetPlayerIp(playerid, IP, 16);
- format(TempStr, sizeof (TempStr), "%s (ID: %d) IP: %s", xname, lookupid, IP);
- SendClientMessage(playerid, COLOR_GREEN, TempStr);
- return 1;
- }
- CMD:godmode(playerid,params[])
- {
- #define INFINITY (Float:0x7F800000)
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- SendClientMessage(playerid, 0xFFFFFFFF,"Godmode has been actived. Now, you cant use weapons.");
- SetPlayerHealth (playerid,INFINITY);
- SetPlayerArmour (playerid,INFINITY);
- }
- return 1;
- }
- CMD:god2(playerid, params[])
- {
- #define INFINITY (Float:0x7F800000)
- new id, string[128], string2[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /godmode [playerID]");
- SetPlayerHealth (id,INFINITY);
- SetPlayerArmour (id,INFINITY);
- format(string, sizeof(string),"Le diste GODMODE a %s!", Name(id));//Obteniendo el nombre de la persona que recibió el jetpack.
- SendClientMessage(playerid, COLOR_GREEN, string);
- format(string2 ,sizeof(string2),"%s te dio GODMODE!",Name(playerid));//Obteniendo el nombre del jugador que utilizó el comando
- SendClientMessage(id, COLOR_GREEN, string2);
- }
- return 1;
- }
- CMD:godcar2(playerid, params[])
- {
- #define INFINITY (Float:0x7F800000)
- new id, string[128];
- if(!IsPlayerAdmin(playerid)) return 0;
- {
- if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /godmode [playerID]");
- SetVehicleHealth(GetPlayerVehicleID(id), 9999999);
- //SetVehicleHealth(GetPlayerVehicleID(id), INFINITY);
- format(string, sizeof(string),"Le diste GODMODE a %s!", Name(id));//Obteniendo el nombre de la persona que recibió el jetpack.
- SendClientMessage(playerid, COLOR_GREEN, string);
- }
- return 1;
- }
- CMD:sms(playerid, params[])
- {
- new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
- if(sscanf(params, "us[256]", id, str2))
- {
- SendClientMessage(playerid, 0xFF0000FF, "USAR: /sms <id> <mensaje>");
- return 1;
- }
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Usuario no conectado");
- if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: No podes enviarte a ti mismo!");
- {
- GetPlayerName(playerid, Name1, sizeof(Name1));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(str, sizeof(str), "SMS a %s(ID %d) enviado con exito!", Name2, id);
- SendClientMessage(playerid, COLOR_GREEN, str);
- format(str, sizeof(str), "SMS de %s(ID %d): %s", Name1, playerid, str2);
- // printf("%s(ID %d): %s",Name2, id Name1, playerid, str2);
- printf("SMS de %s para %s: %s", Name1, Name2, str2);
- SendClientMessage(id, COLOR_GREEN, str);
- }
- return 1;
- }
- CMD:clearc(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- ClearChatboxAll();
- SendClientMessageToAll(COLOR_RED, "LogChat borrado");
- }
- else
- {
- return 0;
- }
- return 1;
- }
- CMD:tomacrash(playerid, params[], giveplayerid)
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(sscanf(params, "d", giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Utilize: /tomacrash <id>");
- CrashPlayer(giveplayerid);
- return 1;
- }
- CMD:amusic(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"No estas autorizado para utilizar este comando");
- {
- if(!sscanf(params, "s", params[0]))
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- StopAudioStreamForPlayer(i);
- PlayAudioStreamForPlayer(i, params[0]);
- // PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=49731");
- }
- else SendClientMessage(playerid,-1,"/amusic [link]");
- }
- }
- }
- return 1;
- }
- CMD:rconasdasd(playerid)
- {
- AccederRCON(playerid);
- return 1;
- }
- //comandos register
- CMD:register( playerid, params[ ] )
- {
- #pragma unused params
- if ( GetPVarInt( playerid, "Logged" ) == 1 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Ya estas registrado, inicia sesion.");
- ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Registrando...", "{FFFFFF}Por favor escriba la contraseña.", ">>>", "Exit");
- return 1;
- }
- CMD:login( playerid, params[ ] )
- {
- #pragma unused params
- if ( GetPVarInt( playerid, "Logged" ) == 1 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Ya estas logeado.");
- ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor escriba la contraseña", "Login", "Kick");
- return 1;
- }
- CMD:cambiarpass( playerid, params[ ] )
- {
- if ( !INI_Exist( pName( playerid ) ) )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Necesitas estar registrado para cambiar la contraseña.Use "COL_LIGHTBLUE"/registrar{FFFFFF}.");
- if ( GetPVarInt( playerid, "Logged" ) == 0 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Por favor "COL_LIGHTBLUE"/iniciarsesion{FFFFFF} para cambiar la contraseña.");
- new NewPass[ 21 ], OldPass[ 21 ];
- if ( sscanf( params, "ss", OldPass, NewPass ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /cambiarpass [VIEJA] [NUEVA]");
- new PlayerFile[ 13 + MAX_PLAYER_NAME ];
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true, playerid );
- new Password[ 20 ],
- String[ 129 ]
- ;
- GetPVarString( playerid, "pPass", Password, 20 );
- if ( strcmp( Password, OldPass, false ) != 0 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Old password didn't match the one you inserted!");
- if ( strlen( NewPass ) < 3 || strlen( NewPass ) > 20 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} La nueva contraseña debe contener minimo 3 caracteres y un maximo de 20.");
- format( String, sizeof String, "Has cambiado la contraseña a \""COL_LIGHTBLUE"%s{FFFFFF}\" ", NewPass );
- SendClientMessage( playerid, -1, String );
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- INI_WriteString( PlayerAcc, "OLD_PASSWORD", OldPass);
- INI_WriteString( PlayerAcc, "PASSWORD", NewPass);
- INI_Close( PlayerAcc );
- return 1;
- }
- CMD:miscomandos( playerid, params[ ] )
- {
- new LongString[ 1024 ];
- new Str1[ ] = ""COL_LIGHTBLUE"Tus comandos disponibles son{FFFFFF}\n\n\n\
- Si usted es vip use"COL_LIGHTBLUE"/vipayuda{FFFFFF} para ver sus comandos disponibles.\n";
- new Str2[ ] = "Use "COL_LIGHTBLUE"/estadisticasFFFFFF} para ver sus estadisticas!\n\
- Use "COL_LIGHTBLUE"/cambiarpass{FFFFFF} para cambiar su contraseña.";
- format( LongString, 1024, "%s%s", Str1, Str2 );
- ShowPlayerDialog( playerid, INFO_BOX, DIALOG_STYLE_MSGBOX, "{FFFFFF}Mis comandos", LongString, "Okey", "");
- return 1;
- }
- stock GetPlayerLevelName( playerid )
- {
- new Llevel[ 14 ];
- if ( GetPVarInt( playerid, "Level" ) == 0 ) Llevel = Level0;
- if ( GetPVarInt( playerid, "Level" ) == 1 ) Llevel = Level1;
- if ( GetPVarInt( playerid, "Level" ) == 2 ) Llevel = Level2;
- if ( GetPVarInt( playerid, "Level" ) == 3 ) Llevel = Level3;
- return Llevel;
- }
- CMD:setlevel( playerid, params[ ] )
- {
- if ( GetPVarInt( playerid, "Level" ) < 3 && !IsPlayerAdmin( playerid ) )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command");
- if ( sscanf( params, "ui", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /setlevel <id/name> <level> "),SendClientMessage( playerid, -1, "-Check "COL_LIGHTBLUE"/levelranks{FFFFFF} to view each level's name");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");
- if ( params[ 1 ] < 0 || params[ 1 ] > 3 )
- return SendClientMessage( playerid, -1, "You must insert from level "COL_LIGHTBLUE"0{FFFFFF} to "COL_LIGHTBLUE"3{FFFFFF}");
- if ( GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher in grade than you.");
- SetPVarInt( params[ 0 ], "Level", params[ 1 ] );
- new String[ 256 ];
- if ( playerid == params[ 0 ] )
- {
- format( String, sizeof String, "You made yourself an admin level "COL_LIGHTBLUE"%d{FFFFFF}["COL_LIGHTBLUE"%s{FFFFFF}]", params[ 1 ], GetPlayerLevelName( playerid ) );
- SendClientMessage( playerid, -1, String );
- }
- else
- {
- format( String, sizeof String, "You made "COL_LIGHTBLUE"%s{FFFFFF} an "COL_LIGHTBLUE"%s{FFFFFF} level "COL_LIGHTBLUE"%d",pName( params[ 0 ] ), GetPlayerLevelName( playerid ), params[ 1 ] );
- SendClientMessage( playerid, -1, String );
- format( String, sizeof String, "%s( %s ) made you an %s",pName( playerid ), GetPlayerLevelName( playerid ),GetPlayerLevelName( params[ 0 ] ) );
- SendClientMessage( params[ 0 ], -1, String );
- }
- return 1;
- }
- CMD:setvip( playerid, params[ ] )
- {
- if ( GetPVarInt( playerid, "Level" ) < 3 )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command!");
- if ( sscanf( params, "ui", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /setvip <id/name> <level> ");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");
- if ( params[ 1 ] < 0 || params[ 1 ] > 3 )
- return SendClientMessage( playerid, -1, "You must insert from level "COL_LIGHTBLUE"0{FFFFFF} to "COL_LIGHTBLUE"3{FFFFFF}");
- if (GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher in grade than you.");
- SetPVarInt( params[ 0 ], "VIP Level", params[ 1 ] );
- new String[ 256 ];
- if ( playerid == params[ 0 ] )
- {
- format( String, sizeof String, "You made yourself a VIP level "COL_LIGHTBLUE"%d", params[ 1 ]);
- SendClientMessage( playerid, -1, String );
- }
- else
- {
- format( String, sizeof String, "You made "COL_LIGHTBLUE"%s{FFFFFF} a VIP level %d", pName( params[ 0 ] ),params[ 1 ] );
- SendClientMessage( playerid, -1, String );
- format( String, sizeof String, "%s( %s ) made you a VIP Level %d",pName( playerid ), GetPlayerLevelName( playerid ), params[ 1 ] );
- SendClientMessage( params[ 0 ], -1, String );
- }
- return 1;
- }
- CMD:mute( playerid,params[])
- {
- if ( GetPVarInt( playerid, "Level" ) < 2 )
- return SendClientMessage( playerid, -1, "You must be an "#Level2" to use this command");
- if ( sscanf( params, "u", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /mute <id/name>");
- if ( GetPVarInt( playerid, "Muted" ) == 1 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Player is already muted.");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");
- if (GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher in grade than you.");
- SetPVarInt( params[ 0 ], "Muted", 1 );
- new String[ 245 ];
- format( String, sizeof String, "You muted "COL_LIGHTBLUE"%s", pName( params[ 0 ] ));
- SendClientMessage( playerid, -1, String );
- format( String, sizeof String, ""COL_LIGHTBLUE"%s( %s ){FFFFFF} muted you.",pName( playerid ), GetPlayerLevelName( playerid ));
- SendClientMessage( params[ 0 ], -1, String );
- return 1;
- }
- /*CMD:gth( playerid,params[])
- {
- if ( GetPVarInt( playerid, "Level" ) < 1 )
- return SendClientMessage( playerid, -1, "Necesitas admin "#Level1" para usar este comando");
- if ( sscanf( params, "u", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"USP:{FFFFFF} /gth <id>");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerInterior(playerid);
- SetPlayerPos(params[0], x+1, y+1, z);
- SetPlayerInterior(params[0], GetPlayerInterior(playerid));
- return 1;
- }
- */
- CMD:gth(playerid,params[])
- {
- new Float:x, Float:y, Float:z;
- if(GetPVarInt( playerid, "Level" ) < 1) {
- SendClientMessage(playerid,COLOR_RED,"[ERROR]: No sos moderador.");
- }
- else {
- if(sscanf(params,"d",params[0])) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: /gethere [playerID]");
- GetPlayerPos(playerid, x, y, z);
- GetPlayerInterior(playerid);
- SetPlayerPos(params[0], x+1, y+1, z);
- SetPlayerInterior(params[0], GetPlayerInterior(playerid));
- }
- return 1;
- }
- CMD:unmute( playerid,params[])
- {
- if ( GetPVarInt( playerid, "Level" ) < 2 )
- return SendClientMessage( playerid, -1, "You must be an "#Level2" to use this command");
- if ( sscanf( params, "u", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /mute <id/name>");
- if ( GetPVarInt( playerid, "Muted" ) == 0 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Player is already un-muted.");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Player is not connected");
- if (GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
- return SendClientMessage( playerid, -1, "You are not allowed to use this command on this admin."),SendClientMessage( playerid, -1, "REASON: Player is higher in grade than you.");
- SetPVarInt( params[ 0 ], "Muted", 0 );
- new String[ 245 ];
- format( String, sizeof String, "You unmuted "COL_LIGHTBLUE"%s", pName( params[ 0 ] ));
- SendClientMessage( playerid, -1, String );
- format( String, sizeof String, ""COL_LIGHTBLUE"%s( %s ){FFFFFF} unmuted you.",pName( playerid ), GetPlayerLevelName( playerid ));
- SendClientMessage( params[ 0 ], -1, String );
- return 1;
- }
- CMD:spawn( playerid,params[])
- {
- if ( GetPVarInt( playerid, "Level" ) < 2 )
- return SendClientMessage( playerid, -1, "Necesitas ser "#Level2" para usar este comando");
- if ( sscanf( params, "u", params[ 0 ], params[ 1 ] ) )
- return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"[USO]:{FFFFFF} /spawn <id/nombre>");
- if ( !IsPlayerConnected( params[ 0 ] ) )
- return SendClientMessage( playerid, -1, ""COL_RED"Usuario no conectado");
- if (GetPVarInt( playerid, "Level" ) < GetPVarInt( params[ 0 ], "Level" ) )
- return SendClientMessage( playerid, -1, "No tenes permitido usar este comando para usar en un admin."),SendClientMessage( playerid, -1, "RAZON: Este admin tiene mas poder que vos.");
- SpawnPlayer( params[ 0 ] );
- new String[ 245 ];
- format( String, sizeof String, "You spawned "COL_LIGHTBLUE"%s", pName( params[ 0 ] ) );
- SendClientMessage( playerid, -1, String );
- format( String, sizeof String, ""COL_LIGHTBLUE"%s( %s ){FFFFFF} te spawneo.",pName( playerid ), GetPlayerLevelName( playerid ));
- SendClientMessage( params[ 0 ], -1, String );
- return 1;
- }
- CMD:vipgod( playerid,params[])
- {
- if ( GetPVarInt( playerid, "VIP Level" ) < 1 )
- return SendClientMessage( playerid, -1, "You must be an VIP Level 1 to use this command");
- if ( GetPVarInt( playerid, "God" ) == 0 )
- {
- if(InJail[playerid] == 1){
- SetPVarInt( playerid, "God", 0);
- KillTimer( God[ playerid ] );
- SetPlayerHealth( playerid, 100.0 );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Estas en sancion no podes usar este comando!");
- }else{
- SetPVarInt( playerid, "God", 1);
- God[ playerid ] = SetTimerEx( "GodTimer", 200, true, "i", playerid );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"GodMode{FFFFFF} activado!");
- }
- }
- else
- {
- SetPVarInt( playerid, "God", 0);
- KillTimer( God[ playerid ] );
- SetPlayerHealth( playerid, 100.0 );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"GodMode{FFFFFF} desactivado!");
- }
- /*if(InJail[playerid] == 1)
- {
- SetPVarInt( playerid, "God", 0);
- KillTimer( God[ playerid ] );
- SetPlayerHealth( playerid, 100.0 );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Estas en sancion no podes usar este comando!");
- }*/
- return 1;
- }
- CMD:vipcargod( playerid,params[])
- {
- if ( GetPVarInt( playerid, "VIP Level" ) < 1 )
- return SendClientMessage( playerid, -1, "Necesitas ser VIP1");
- if ( GetPVarInt( playerid, "CGod" ) == 0 )
- {
- SetPVarInt( playerid, "CGod", 1);
- CGod[ playerid ] = SetTimerEx( "CarGodTimer", 200, true, "i", playerid );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Car God{FFFFFF} activado!");
- }
- else
- {
- SetPVarInt( playerid, "CGod", 0);
- KillTimer( CGod[ playerid ] );
- SetVehicleHealth( GetPlayerVehicleID( playerid ), 1000.0 );
- SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Car God{FFFFFF} desactivado!");
- }
- return 1;
- }
- CMD:duelo(playerid, params[])
- {
- new string[128];
- if(InvitedDuel[playerid] == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Você Já Convidou alguém,Aguarde Expirar o Convite");
- if(UsingArena == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Zona de Duelo esta siendo usada.");
- if(isnull(params)) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Deve digitar el ID(/duelo-run [playerid])");
- new id = strval(params);
- if(id == playerid) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Você não pode convidar a Si-Mesmo");
- if(InvitedDuel[id] == true) return SendClientMessage(playerid,0xF41917AA,"»»[DUELO]«« : Ahora no, Aguarde..");
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "»»[DUELO]«« : %s te esta desafiando \n a un duelo (Cliquee aceptar para aceptar el duelo)",name);
- ShowPlayerDialog(id,DIALOG_DUEL,DIALOG_STYLE_MSGBOX,"»»[DUELO]«« :",string,"Aceptar", "Rechazar");
- SetPlayerPos(playerid, 1731.8315,-2864.7705,6.5554);
- GameTextForPlayer(id,"~r~DUE~w~LO !", 2500, 3);
- InvitedDuel[id] = true;
- IdDuel[id] = playerid;
- SetTimerEx("LimparDuelo",15000,false,"ii",id,playerid);
- return 1;
- }
- CMD:acmds( playerid, params[ ] )
- {
- if ( GetPVarInt( playerid, "Level" ) < 1 )
- //return SendClientMessage( playerid, -1, "You must be an Admin level 1 or above to view the commands");
- return 0;
- new CBox[ 512 ];
- format( CBox, sizeof CBox, "{FFFFFF}Comandos administrativos\n\n\n\
- "COL_RED"Level {FFFFFF}1 "COL_RED"- {FFFFFF}( "COL_RED""Level1" {FFFFFF})\n\
- /settime /setweather /sethp /setarmour /givemoney\n\n\
- "COL_RED"Level {FFFFFF}2 "COL_RED"- {FFFFFF}( "COL_RED""Level2" {FFFFFF})\n");
- format( CBox, sizeof CBox, "%s /freeze /unfreeze /kick /spawn /setweapon /setscore\n\n\
- "COL_RED"Level {FFFFFF}3 "COL_RED"- {FFFFFF}( "COL_RED""Level3" {FFFFFF})\n\
- /gmx /ban\n\n\n\
- Lea las reglas administrativas-> "COL_RED"/areglas", CBox);
- ShowPlayerDialog( playerid, INFO_BOX, DIALOG_STYLE_MSGBOX, "{FFFFFF}Comandos administrativos", CBox, "Okey", "");
- return 1;
- }
- CMD:viphelp( playerid, params[ ] )
- {
- if ( GetPVarInt( playerid, "Level" ) < 1 )
- return SendClientMessage( playerid, -1, "You must be a VIP Member to use this command");
- ShowPlayerDialog( playerid, INFO_BOX, DIALOG_STYLE_MSGBOX, "{FFFFFF}Admin Commands", "{FFFFFF}Few VIP Commands.\n\n\n\
- "COL_LIGHTBLUE"Level {FFFFFF}1\n\
- /vipgod\n\n\
- "COL_LIGHTBLUE"Level {FFFFFF}2\n\
- /vipgod /vipcargod\n\n\
- "COL_LIGHTBLUE"Level {FFFFFF}3\n\
- /vipgod /vipcargod /vnrg /vinf\n\n\n", "Oke", "");
- return 1;
- }
- CMD:arules( playerid, params[ ] )
- {
- if ( GetPVarInt( playerid, "Level" ) < 1 )
- return SendClientMessage( playerid, -1, "You must be an Admin level 1 or above to view the Admin Rules");
- new CBox[ 700 ];
- format( CBox, sizeof CBox, "{FFFFFF}Current Admin Rules\n\n\n\
- "COL_RED"Level {FFFFFF}1 "COL_RED"- {FFFFFF}( "COL_RED""Level1" {FFFFFF})\n\
- -Your duty is to ensure a player's pleasure to play on the server, set his time\n\
- set his wather, etc.\n\n\
- "COL_RED"Level {FFFFFF}2 "COL_RED"- {FFFFFF}( "COL_RED""Level2" {FFFFFF})\n");
- format( CBox, sizeof CBox, "%s-Your job is to ensure nobody abuses the commands, or insults players\n\
- you must take control over mean players and punish them.\n\n\
- "COL_RED"Level {FFFFFF}3 "COL_RED"- {FFFFFF}( "COL_RED""Level3" {FFFFFF})\n\
- -The "Level3" can do whatever they want, you cannot judge their actions.\n\n\n\
- Please take a look at the Admin Commands -> "COL_RED"/acmds", CBox);
- ShowPlayerDialog( playerid, INFO_BOX, DIALOG_STYLE_MSGBOX, "{FFFFFF}Admin Commands", CBox, "Oke", "");
- return 1;
- }
- COMMAND:spec(playerid, params[])
- {
- new id;// This will hold the ID of the player you are going to be spectating.
- if(!IsPlayerAdmin(playerid))return 0;// This checks if the player is logged into RCON, if not it will return 0; (Showing "SERVER: Unknown Command") You can replace it with your own admin check.
- if(sscanf(params,"u", id))return SendClientMessage(playerid, Grey, "Usage: /spec [id]");// Now this is where we use sscanf to check if the params were filled, if not we'll ask you to fill them
- if(id == playerid)return SendClientMessage(playerid,Grey,"You cannot spec yourself.");// Just making sure.
- if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, Grey, "Player not found!");// This is to ensure that you don't fill the param with an invalid player id.
- if(IsSpecing[playerid] == 1)return SendClientMessage(playerid,Grey,"You are already specing someone.");// This will make you not automatically spec someone else by mistake.
- GetPlayerPos(playerid,SpectaX[playerid],SpectaY[playerid],SpectaZ[playerid]);// This is getting and saving the player's position in a variable so they'll respawn at the same place they typed '/spec'
- Interspec[playerid] = GetPlayerInterior(playerid);// Getting and saving the interior.
- vWorldspec[playerid] = GetPlayerVirtualWorld(playerid);//Getting and saving the virtual world.
- TogglePlayerSpectating(playerid, true);// Now before we use any of the 3 functions listed above, we need to use this one. It turns the spectating mode on.
- if(IsPlayerInAnyVehicle(id))//Checking if the player is in a vehicle.
- {
- if(GetPlayerInterior(id) > 0)//If the player's interior is more than 0 (the default) then.....
- {
- SetPlayerInterior(playerid,GetPlayerInterior(id));//.....set the spectator's interior to that of the player being spectated.
- }
- if(GetPlayerVirtualWorld(id) > 0)//If the player's virtual world is more than 0 (the default) then.....
- {
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));//.....set the spectator's virtual world to that of the player being spectated.
- }
- PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));// Now remember we checked if the player is in a vehicle, well if they're in a vehicle then we'll spec the vehicle.
- }
- else// If they're not in a vehicle, then we'll spec the player.
- {
- if(GetPlayerInterior(id) > 0)
- {
- SetPlayerInterior(playerid,GetPlayerInterior(id));
- }
- if(GetPlayerVirtualWorld(id) > 0)
- {
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
- }
- PlayerSpectatePlayer(playerid,id);// Letting the spectator spec the person and not a vehicle.
- }
- GetPlayerName(id, Namespec, sizeof(Namespec));//Getting the name of the player being spectated.
- format(stringspec, sizeof(stringspec),"Empezaste a spectear a %s.",Namespec);// Formatting a string to send to the spectator.
- SendClientMessage(playerid,0x0080C0FF,stringspec);//Sending the formatted message to the spectator.
- IsSpecing[playerid] = 1;// Just saying that the spectator has begun to spectate someone.
- IsBeingSpeced[id] = 1;// Just saying that a player is being spectated (You'll see where this comes in)
- spectatorid[playerid] = id;// Saving the spectator's id into this variable.
- return 1;// Returning 1 - saying that the command has been sent.
- }
- COMMAND:specoff(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))return 0;// This checks if the player is logged into RCON, if not it will return 0; (Showing "SERVER: Unknown Command")
- //if(IsSpecing[playerid] == 0)return SendClientMessage(playerid,Grey,"You are not spectating anyone.");
- TogglePlayerSpectating(playerid, 0);//Toggling spectate mode, off. Note: Once this is called, the player will be spawned, there we'll need to reset their positions, virtual world and interior to where they typed '/spec'
- SpawnPlayer(playerid);
- return 1;
- }
- COMMAND:congelartodos(playerid, params[])
- {
- assert(IsPlayerAdmin(playerid));
- for (new i; i < GetMaxPlayers(); i++)
- {
- if (IsPlayerConnected(i)) TogglePlayerControllable(i,0);
- }
- return 1;
- }
- /*COMMAND:sancion(playerid,params[])
- {
- if(GetPVarInt( playerid, "Level" ) > 0)
- {
- new pId, time;
- if(sscanf(params, "dds[128]", pId, time, params[3])) return SendClientMessage(playerid, 0xFF0000AA, "USO: /sancion [ID] [minutos] [razon]");
- else if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, 0xFF0000AA, "Usuario no conectado");
- else
- {
- new pname[MAX_PLAYER_NAME], jname[MAX_PLAYER_NAME], string1[250];
- GetPlayerName(playerid, pname, sizeof(pname));
- GetPlayerName(pId, jname, sizeof(jname));
- SetPlayerInterior(pId, 3);
- new rand = random(sizeof(JailCellSpawns));
- SetPlayerVirtualWorld(pId,21);
- SetPlayerPos(pId, JailCellSpawns[rand][0], JailCellSpawns[rand][1], JailCellSpawns[rand][2]);
- SetTimerEx("UnJail",time*1000*60,0,"i",pId);
- InJail[pId] = 1;
- tiempo[playerid] = gettime()+(time*1000*60);
- ResetPlayerWeapons(pId);
- format(string1, sizeof(string1), "%s(%d) fue sancionado por un admin. Razon: %s", jname, pId, params[3]);
- SendClientMessageToAll(COLOR_RED, string1);
- //les saco el godmode
- SetPVarInt( pId, "God", 0);
- KillTimer( God[ pId ] );
- SetPlayerHealth( pId, 100.0 );
- return 1;
- }
- }
- else
- {
- return 0;
- }
- }*/
- COMMAND:sancion(playerid,params[])
- {
- if(GetPVarInt( playerid, "Level" ) > 0)
- {
- new pId, time;
- if(sscanf(params, "dds[128]", pId, time, params[3])) return SendClientMessage(playerid, 0xFF0000AA, "USO: /sancion [ID] [minutos] [razon]");
- else if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, 0xFF0000AA, "Usuario no conectado");
- else
- {
- new pname[MAX_PLAYER_NAME], jname[MAX_PLAYER_NAME], string1[250];
- GetPlayerName(playerid, pname, sizeof(pname));
- GetPlayerName(pId, jname, sizeof(jname));
- SetPlayerInterior(pId, 3);
- new rand = random(sizeof(JailCellSpawns));
- SetPlayerVirtualWorld(pId,21);
- SetPlayerPos(pId, JailCellSpawns[rand][0], JailCellSpawns[rand][1], JailCellSpawns[rand][2]);
- ATiempo(csancion[playerid], min_s(time));
- SetTimerEx("UnJail",time*1000*60,0,"i",pId);
- InJail[pId] = 1;
- ResetPlayerWeapons(pId);
- format(string1, sizeof(string1), "%s(%d) fue sancionado por un admin. Razon: %s", jname, pId, params[3]);
- SendClientMessageToAll(COLOR_RED, string1);
- //les saco el godmode
- SetPVarInt( pId, "God", 0);
- KillTimer( God[ pId ] );
- SetPlayerHealth( pId, 100.0 );
- return 1;
- }
- }
- else
- {
- return 0;
- }
- }
- COMMAND:tiempo(playerid, params[])
- {
- if(ETiempo(csancion[playerid]))
- {
- //new m[48];
- //format(m, sizeof m, "Te faltan %d para salir de la carcel...", OTiempo(csancion[playerid]));
- //No esta en la carcel
- }
- else
- {
- //Esta encarcelado
- new m[48];
- format(m, sizeof m, "Te faltan %d para salir de la carcel...", OTiempo(csancion[playerid]));
- SendClientMessage(playerid, -1, m);
- }
- return 1;
- }
- COMMAND:gotox(playerid,params[])
- {
- new Float:x,Float:y,Float:z;
- if(sscanf(params,"fff",x,y,z))return SendClientMessage(playerid,0xff0000FF,"ERROR: Usage /goto [interior][xcoord][ycoord][zcoord]");
- else
- {
- //SetPlayerInterior(playerid,interior);
- SetPlayerPos(playerid,x,y,z);
- }
- return 1;
- }
- CMD:stats( playerid, paramz[ ] )
- {
- if ( GetPVarInt( playerid, "Logged" ) == 0 )
- return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Para ver tus estadisticas tenes que haber iniciado sesion. ");
- new
- iBox[ 1024 ],
- RegDate[ 40 ],
- pLastOn[ 20 + 20 ],
- pLevel = GetPVarInt( playerid, "Level")
- ;
- GetPVarString( playerid, "Date", RegDate, sizeof RegDate );
- GetPVarString( playerid, "On", pLastOn, sizeof pLastOn );
- format( iBox, sizeof iBox, "{FFFFFF}Hola "COL_LIGHTBLUE"%s{FFFFFF}, estas son tus estadisticas.\n\n\
- {FFFFFF}Admin level: "COL_LIGHTBLUE"%s{FFFFFF}["COL_LIGHTBLUE"%d{FFFFFF}]\n\
- {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Dinero: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Asesinatos: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Muertes: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Fecha de Registro: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}Interior: "COL_LIGHTBLUE"%d\n",
- pName( playerid ),
- GetPlayerLevelName( playerid ),
- pLevel,
- GetPlayerVLevel( playerid ),
- GetPlayerMoney( playerid ),
- GetPlayerScore( playerid ),
- GetPVarInt( playerid,"Kills" ),
- GetPVarInt( playerid,"Deaths" ),
- RegDate,
- GetPlayerInterior( playerid ) );
- format( iBox, sizeof iBox, "%s{FFFFFF}Virtual World: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Skin: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Ultima vez activo: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}Car God: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}Player God: "COL_LIGHTBLUE"%s",
- iBox,
- GetPlayerVirtualWorld( playerid ),
- GetMySkin( playerid ),
- pLastOn,
- GetPVarInt( playerid, "CGod" ) ? (""COL_GREEN"Yes") : (""COL_RED"No"),
- GetPVarInt( playerid, "God" ) ? (""COL_GREEN"Yes") : (""COL_RED"No"));
- ShowPlayerDialog( playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "{FFFFFF}Tus estadisticas!", iBox, "Ok", "");
- return 1;
- }
- public OnPlayerDeath( playerid, killerid, reason )
- {
- if(InvitedDuel[killerid] == true)
- {
- new Float:healthkiller;
- new namekiller[24],namedeather[24],string[44];
- GetPlayerName(killerid, namekiller, 24);
- GetPlayerName(playerid, namedeather, 24);
- GetPlayerHealth(killerid,healthkiller);
- format(string, sizeof(string), "»»[DUELO]«« : %s Wins Duel of %s how %0.0f off Armour and Health",namekiller,namedeather,healthkiller);
- SendClientMessageToAll(0xF600F6AA, string);
- InvitedDuel[killerid] = false;
- InvitedDuel[playerid] = false;
- IdDuel[playerid] = playerid;
- IdDuel[killerid] = killerid;
- UsingArena = false;
- healthkiller = 0;
- SpawnPlayer(killerid);
- }
- if(IsBeingSpeced[playerid] == 1)//If the player being spectated, dies, then turn off the spec mode for the spectator.
- {
- foreach(Player,i)
- {
- if(spectatorid[i] == playerid)
- {
- TogglePlayerSpectating(i,false);// This justifies what's above, if it's not off then you'll be either spectating your connect screen, or somewhere in blueberry (I don't know why)
- }
- }
- }
- SetPVarInt( killerid, "Kills", GetPVarInt( playerid, "Kills" ) + 1 );
- SetPVarInt( playerid, "Deaths", GetPVarInt( playerid, "Deaths" ) + 1 );
- GivePlayerScore(killerid,1);
- if(killerid != INVALID_PLAYER_ID)
- {
- SendDeathMessage(killerid,playerid,reason);
- GivePlayerMoney(killerid,400);
- GameTextForPlayer(playerid,"PISO",2000,5);//<-- that's what we need now.
- TextDrawHideForPlayer(playerid, ArribaVida[playerid]);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if((newstate & PLAYER_STATE_DRIVER) && (oldstate & PLAYER_STATE_ONFOOT))
- if( 0 < paramsvDealer[ GetPlayerVehicleID(playerid) ][ inumDealer ] <= MAX_DEALERS )
- {
- static
- sz@vDialogCar[0x190],
- var@Temp[0x80];
- sz@vDialogCar[0] = '\0', var@Temp[0] = '\0';
- TogglePlayerControllable( playerid, false );
- SetVehicleParamsForAll( GetPlayerVehicleID(playerid), false, true );
- obs@Venta[ playerid ][ 1 ] = paramsvDealer[ GetPlayerVehicleID( playerid ) ][ inumID ];
- format(var@Temp, sizeof var@Temp, " \t{FF0000}Nombre: {FFFFFF}%s.\n", paramsvDealer[GetPlayerVehicleID(playerid)][sCarName]);
- strcat(sz@vDialogCar, var@Temp, 0x136);
- format(var@Temp, sizeof var@Temp, " \t{FF0000}Precio: {FFFFFF}$%i.\n", paramsvDealer[GetPlayerVehicleID(playerid)][iPrice]);
- strcat(sz@vDialogCar, var@Temp, 0x136);
- strcat(sz@vDialogCar, "\t {FF0000}Bienvenido al {FFFFFF}vehículo de pruebas.\n", 0x136);
- strcat(sz@vDialogCar, " {FFFFFF}¿Deseas comprar este vehículo ? Pulsa '{008000}Aceptar{FFFFFF}' de lo contrario, '{008000}Cancelar{FFFFFF}'\n.", 0x136);
- format(var@Temp, sizeof var@Temp, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Concesionaría N°%d", paramsvDealer[GetPlayerVehicleID(playerid)][inumDealer]);
- ShowPlayerDialog( playerid, showAnounceVehicle, DIALOG_STYLE_MSGBOX, var@Temp, sz@vDialogCar, "Aceptar.", "Cancelar.");
- }
- if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)// If the player's state changes to a vehicle state we'll have to spec the vehicle.
- {
- if(IsBeingSpeced[playerid] == 1)//If the player being spectated, enters a vehicle, then let the spectator spectate the vehicle.
- {
- foreach(Player,i)
- {
- if(spectatorid[i] == playerid)
- {
- PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));// Letting the spectator, spectate the vehicle of the player being spectated (I hope you understand this xD)
- }
- }
- }
- }
- if(newstate == PLAYER_STATE_ONFOOT)
- {
- if(IsBeingSpeced[playerid] == 1)//If the player being spectated, exists a vehicle, then let the spectator spectate the player.
- {
- foreach(Player,i)
- {
- if(spectatorid[i] == playerid)
- {
- PlayerSpectatePlayer(i, playerid);// Letting the spectator, spectate the player who exited the vehicle.
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)//This is called when a player's interior is changed.
- {
- if(IsBeingSpeced[playerid] == 1)//If the player being spectated, changes an interior, then update the interior and virtualword for the spectator.
- {
- foreach(Player,i)
- {
- if(spectatorid[i] == playerid)
- {
- SetPlayerInterior(i,GetPlayerInterior(playerid));
- SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(playerid));
- }
- }
- }
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- /*---------------------------------------------------
- * OnVehicleRespray.
- *Params:
- - playerid
- - vehicleid
- - color1
- - color2
- *Función:
- - Mediante dos bucles (recorriendo los jugadores y los vehículos
- de estos, se actualiza el la variable del nuevo paintjob
- añadido a los vehículos.
- --------------------------------------------------*/
- for( new i = MAX_PLAYERS-1; i > -1; --i )
- {
- static
- j;
- j = -1;
- while( ++j < MAX_VEH_PER_PLAYER )
- {
- if((( playerVehicle[i][j][status] ) && ( playerVehicle[i][j][icnumID] == vehicleid )))
- {
- playerVehicle[i][j][mods][mPaintjob] = paintjobid;
- break;
- }
- else continue;
- }
- }
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- /*---------------------------------------------------
- * OnVehicleRespray.
- *Params:
- - playerid
- - vehicleid
- - color1
- - color2
- *Función:
- - Mediante dos bucles (recorriendo los jugadores y los vehículos
- de estos, se actualiza la variable del nuevo color de pintura añadida
- a los vehículos.
- --------------------------------------------------*/
- for( new i = MAX_PLAYERS-1; i > -1; --i )
- {
- static
- j;
- j = -1;
- while( ++j < MAX_VEH_PER_PLAYER )
- {
- if((( playerVehicle[i][j][status] ) && ( playerVehicle[i][j][icnumID] == vehicleid )))
- {
- playerVehicle[i][j][mods][mColores][0] = color1;
- playerVehicle[i][j][mods][mColores][1] = color2;
- break;
- }
- else continue;
- }
- }
- return 1;
- }
- //============================================================================//
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- /*--------------------------------------------------
- * OnVehicleMod
- *Params:
- - playerid
- - vehicleid
- - componentid
- *Función:
- - Mediante un bucle se verifica que los componentes cargados ( de la tabla )
- para el vehículo sean correctos, de lo contrario, se le asigna un valor
- correcto.
- --------------------------------------------------*/
- for( new i = MAX_PLAYERS-1; i > -1; --i )
- {
- static
- j;
- j = -1;
- while( ++j < MAX_VEH_PER_PLAYER )
- {
- if((( playerVehicle[i][j][status] ) && ( playerVehicle[i][j][icnumID] == vehicleid )))
- {
- switch( GetModType( componentid ) )
- {
- case 1: playerVehicle[i][j][mods][mSpoiler] = componentid;
- case 2: playerVehicle[i][j][mods][mRoof] = componentid;
- case 3: playerVehicle[i][j][mods][mSideskirts][0] = componentid;
- case 4: playerVehicle[i][j][mods][mSideskirts][1] = componentid;
- case 5: playerVehicle[i][j][mods][mNitro] = componentid;
- case 6: playerVehicle[i][j][mods][mLamps] = componentid;
- case 7: playerVehicle[i][j][mods][mExhaust] = componentid;
- case 8: playerVehicle[i][j][mods][mWheels] = componentid;
- case 9: playerVehicle[i][j][mods][mStereo] = componentid;
- case 10: playerVehicle[i][j][mods][mHidraulics] = componentid;
- case 11: playerVehicle[i][j][mods][mPaintjob] = componentid;
- case 12: playerVehicle[i][j][mods][mBullbar] = componentid;
- case 13: playerVehicle[i][j][mods][mRealBullbars] = componentid;
- case 14: playerVehicle[i][j][mods][mFrontSign] = componentid;
- case 15: playerVehicle[i][j][mods][mFrontBullbars] = componentid;
- case 16: playerVehicle[i][j][mods][mBullbars] = componentid;
- case 17: playerVehicle[i][j][mods][mRearBumper] = componentid;
- case 18: playerVehicle[i][j][mods][mVents][0] = componentid;
- case 19: playerVehicle[i][j][mods][mVents][1] = componentid;
- case 20: playerVehicle[i][j][mods][mFrontBumper] = componentid;
- case 21: playerVehicle[i][j][mods][mHood] = componentid;
- default: continue;
- }
- break;
- }
- else continue;
- }
- }
- return 1;
- }
- //============================================================================//
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- /*--------------------------------------------------
- * OnVehicleStreamIn
- *Params:
- - vehicleid
- - forplayerid
- *Función:
- - Mediante un bucle que recorrerá todos los usuarios & vehículos
- seteamos el valor de las puertas ( abiertas | cerradas ) de acuerdo
- a el valor de su variable.
- --------------------------------------------------*/
- for( new j = GetMaxPlayers()-1; j > -1; --j )
- {
- static
- i;
- i = -1;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[j][i][icnumID] == vehicleid )
- {
- SetVehicleParamsEx( vehicleid, playerVehicle[j][i][paramsVeh][pEngine], playerVehicle[j][i][paramsVeh][pLights],
- playerVehicle[j][i][paramsVeh][pAlarm], playerVehicle[j][i][paramsVeh][pLock],
- playerVehicle[j][i][paramsVeh][pBonnet], playerVehicle[j][i][paramsVeh][pBoot],
- playerVehicle[j][i][paramsVeh][pObjective]);
- }
- else continue;
- }
- }
- return 1;
- }
- //============================================================================//
- obtain@dealerVehicles( dealerid )
- {
- /*--------------------------------------------------
- * obtain@dealerVehicles
- * Params:
- - dealerid
- * Función:
- - Obtiene la cantidad de vehículos creados pertenecientes
- al concesionario ingresado (dealerid).
- --------------------------------------------------*/
- static
- i,
- count;
- i = 0, count = 0;
- while( ++i < MAX_VEHICLES )
- {
- if( i == 0 ) continue;
- if( paramsvDealer[ i ][ inumDealer ] == dealerid ) count++;
- else continue;
- }
- return count;
- }
- //============================================================================//
- function:: save@dealerLocations()
- {
- /*--------------------------------------------------
- * save@dealerLocations
- * Params:
- - Sin parámetros.
- * Función:
- - Almacena la información de los concesionarios
- creados.
- --------------------------------------------------*/
- static
- query[0x100],
- count;
- count = 0;
- for( new i = MAX_DEALERS-1; i >= 0; i--)
- {
- dealerLocations[i][d@vehicles] = obtain@dealerVehicles( i );
- if( dealerLocations[ i ][ id@sqlid ] < 1 ) continue;
- else
- {
- mysql_format( cHandle, query, "UPDATE `dealerLocations` SET `DealerName` = '%e', `countVehs` = %d, `max_X` = %f, `min_X` = %f, `max_Y` = %f, `min_Y` = %f WHERE `DealerID` = %d;",
- dealerLocations[i][sz@nameDealer],
- dealerLocations[i][d@vehicles],
- dealerLocations[i][f@maxX],
- dealerLocations[i][f@minX],
- dealerLocations[i][f@maxY],
- dealerLocations[i][f@minY],
- dealerLocations[i][id@sqlid]);
- mysql_function_query( cHandle, query, false, "OnQueryFinish", "d", empty@queryReceived);
- count ++;
- }
- }
- return printf("[wDealer]: Se han guardado %d concesionarios.", count-1);
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- static
- sz@message[0x7D];
- switch( dialogid )
- {
- case showAnounceVehicle:
- {
- if( !response )
- {
- cmd_salirvcar( playerid );
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Has salido del vehículo de pruebas.");
- }
- else cmd_buyvehicle( playerid );
- }
- case showMenuCreateDealer:
- {
- if( !response )
- {
- mysql_format( cHandle, sz@message, "DELETE FROM `dealerLocations` WHERE `DealerID` = %d", dealerLocations[d@optionsEdit[playerid][0]][id@sqlid]);
- mysql_function_query( cHandle, sz@message, false, "OnQueryFinish", "d", empty@queryReceived);
- for( new i = 4; i > -1; --i)
- {
- d@optionsEdit[playerid][i] = 0;
- }
- CallLocalFunction("save@dealerLocations", #);
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Has salido de la edición de concesionarios.");
- }
- else
- {
- switch( listitem )
- {
- case 0: ShowPlayerDialog( playerid, createDealerName, DIALOG_STYLE_INPUT, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Cambio de nombre.", "Digite el nuevo nombre para este concesionario.", "Aceptar.", "Atrás.");
- case 1:
- {
- d@optionsEdit[playerid][0b100] = 1;
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Vaya a la primera posición, pulse 'Y' cuando se encuentre listo o pulse 'ctrl' para finalizar.");
- }
- case 2:
- {
- CallLocalFunction("save@dealerLocations", #);
- for( new i = 4; i > -1; --i)
- {
- d@optionsEdit[playerid][i] = 0;
- }
- SendClientMessage(playerid, -1, "[] Concesionario guardado");
- }
- }
- }
- }
- case createDealerName:
- {
- if( !response )
- {
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario %d", d@optionsEdit[playerid][0]);
- ShowPlayerDialog( playerid, showMenuCreateDealer, DIALOG_STYLE_LIST, sz@message, " 1)\tNombre del concesionario.\n 2)\tPosición del concesionario.\n 3)\tGuardar concesionario.\n", "Seleccionar.", "Cancelar.");
- }
- else
- {
- if( isnull( inputtext ) )
- ShowPlayerDialog( playerid, createDealerName, DIALOG_STYLE_INPUT, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Cambio de nombre.", "Digite el nuevo nombre para este concesionario.", "Aceptar.", "Atrás.");
- else
- {
- strmid( dealerLocations[d@optionsEdit[playerid][0]][sz@nameDealer], inputtext, 0, strlen(inputtext), 0x1E);
- format( sz@message, sizeof sz@message, "\t Concesionario actualizado.\n 1) ID: %d.\n 2) Nombre: %s.\n 3) Vehiculos: %d.\n",
- d@optionsEdit[playerid][0], dealerLocations[d@optionsEdit[playerid][0]][sz@nameDealer],
- dealerLocations[d@optionsEdit[playerid][0]][d@vehicles]);
- ShowPlayerDialog( playerid, showdealerInfoBox, DIALOG_STYLE_MSGBOX, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición", sz@message, "Aceptar.", "Guardar.");
- }
- }
- }
- case showdealerInfoBox:
- {
- if( !response )
- {
- CallLocalFunction("save@dealerLocations", #);
- for( new i = 4; i > -1; --i)
- {
- d@optionsEdit[playerid][i] = 0;
- }
- }
- else
- {
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario %d", d@optionsEdit[playerid][0]);
- ShowPlayerDialog( playerid, showMenuCreateDealer, DIALOG_STYLE_LIST, sz@message, " 1)\tNombre del concesionario.\n 2)\tPosición del concesionario.\n 3)\tGuardar concesionario.\n", "Seleccionar.", "Cancelar.");
- }
- }
- case showMenuDealerEdit:
- {
- if(!response)
- {
- SendClientMessage(playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has salido del menú de edición de concesionario, todos los cambios se han perdido.");
- d@optionsEdit[playerid][0] = 0;
- d@optionsEdit[playerid][0b10] = 0;
- }
- else
- {
- switch(listitem)
- {
- case 0: ShowPlayerDialog( playerid, editDealerName, DIALOG_STYLE_INPUT, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Cambio de nombre.", "Digite el nuevo nombre para este concesionario.", "Aceptar.", "Atrás.");
- case 1:
- {
- d@optionsEdit[playerid][0b100] = 1;
- d@optionsEdit[playerid][0b10] = 1;
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición de posiciones.");
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Vaya a la primera posición, pulse 'Y' cuando se encuentre listo o pulse 'ctrl' para finalizar.");
- }
- case 2:
- {
- mysql_format( cHandle, sz@message, "DELETE FROM `dealerLocations` WHERE `DealerID` = %d", dealerLocations[d@optionsEdit[playerid][0]][id@sqlid]);
- mysql_function_query( cHandle, sz@message, false, "OnQueryFinish", "d", empty@queryReceived);
- new i = -1;
- while( dealerLoc:++i < dealerLoc ) {
- dealerLocations[d@optionsEdit[playerid][0]][dealerLoc:i] = 0;
- }
- for(i = 4; i > -1; --i)
- {
- d@optionsEdit[playerid][i] = 0;
- }
- CallLocalFunction("save@dealerLocations", #);
- SendClientMessage(playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has eliminado el concesionario. Has salido del menú de edición.");
- }
- case 3:
- {
- CallLocalFunction("save@dealerLocations", #);
- for( new i = 4; i > -1; --i)
- {
- d@optionsEdit[playerid][i] = 0;
- }
- }
- }
- }
- }
- case editDealerName:
- {
- if( !response )
- {
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario %d", d@optionsEdit[playerid][0]);
- ShowPlayerDialog(playerid, showMenuDealerEdit, DIALOG_STYLE_LIST, sz@message, "1)\t Nombre del concesionario.\n 2)\tPosicion del concesionario.\n 3)\tEliminar concesionario.\n -> Guardar cambios.", "Seleccionar.", "Cancelar.");
- }
- else
- {
- if( isnull( inputtext ) )
- ShowPlayerDialog( playerid, editDealerName, DIALOG_STYLE_INPUT, "{FF0000}[{FFD700}wDealer{FF0000}]{FFFFFF} Cambio de nombre.", "Digite el nuevo nombre para este concesionario.", "Aceptar.", "Atrás.");
- else
- {
- strmid( dealerLocations[d@optionsEdit[playerid][0]][sz@nameDealer], inputtext, 0, strlen(inputtext), 0x1E);
- SendClientMessage(playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} ¡Nombre actualizado!.");
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario %d", d@optionsEdit[playerid][0]);
- ShowPlayerDialog(playerid, showMenuDealerEdit, DIALOG_STYLE_LIST, sz@message, "1)\t Nombre del concesionario.\n 2)\tPosicion del concesionario.\n 3)\tEliminar concesionario.\n -> Guardar cambios.", "Seleccionar.", "Cancelar.");
- }
- }
- }
- case DIALOG_DUEL:
- {
- if(!response) return ExpireDuel(playerid,IdDuel[playerid]);
- if(response)
- {
- UsingArena = true;
- new name[MAX_PLAYER_NAME], string[44];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "»»[DUEL]«« : %s accepted the challenge, wait 8 seconds to go to Duel.",name);
- SendClientMessage(IdDuel[playerid],0xF6F600AA,string);
- SendClientMessage(playerid,0xF6F600AA,"»»[DUEL]«« : You accepted the Duel Wait 8 seconds to process your Data");
- SetTimerEx("GoDuel",8000,false,"ii",playerid,IdDuel[playerid]);
- }
- return 1;
- }
- case DIALOG_REG:
- {
- if ( response )
- {
- if ( sscanf( inputtext, "s[256]", inputtext[ 0 ] || strlen( inputtext[ 0 ] ) == 0 ) )
- return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
- {FFFFFF}Please write your desired password.\n",
- ">>>", "Exit");
- if ( strlen( inputtext[ 0 ] ) < 3 || strlen( inputtext[ 0 ] ) > 20 )
- return ShowPlayerDialog( playerid, DIALOG_REG, DIALOG_STYLE_INPUT, "{FFFFFF}Password", ""COL_RED"Error!\n\
- {FFFFFF}Please write your desired password.\n\
- "COL_RED"#{FFFFFF}Min. 3 Char. Max. 20 Char.",
- ">>>", "Exit");
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ],
- pDate[ 8 + 15 ], //HH:MM:SS + DD.MM.YYYY = 18
- pYear,
- pMonth,
- pDay,
- pHour,
- pMinute,
- pSecond,
- pIP[ 20 ],
- InfBox[ 512 ]
- ;
- getdate(pYear, pMonth, pDay ),gettime(pHour, pMinute, pSecond );
- GetPlayerIp( playerid, pIP, 20 );
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- format( pDate, sizeof pDate, "%d:%d:%d %d/%d/%d",pHour, pMinute, pSecond , pDay, pMonth, pYear );
- format( InfBox, sizeof InfBox, "{FFFFFF}Su cuenta fue registrada!\n\n\
- "COL_LIGHTBLUE"Cuenta: {FFFFFF}%s\n\
- "COL_LIGHTBLUE"Contraseña: {FFFFFF}%s\n\n\
- Has recibido "COL_GREEN"$5000{FFFFFF} por tu registro.\n\
- Would you like to login?", pName( playerid ),
- inputtext );
- ShowPlayerDialog( playerid, DIALOG_LOG, DIALOG_STYLE_MSGBOX, "Login", InfBox, "Yes", "No" );
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- INI_WriteString( PlayerAcc, "NAME", pName( playerid ) );
- INI_WriteString( PlayerAcc, "PASSWORD", inputtext );
- INI_WriteString( PlayerAcc, "REG_DATE", pDate );
- INI_WriteString( PlayerAcc, "LAST_ON", "Primera vez" );
- INI_WriteInt( PlayerAcc, "MONEYS", 5000 );
- INI_WriteInt( PlayerAcc, "SCORE", 15 );
- INI_WriteInt( PlayerAcc, "KILLS", 0 );
- INI_WriteInt( PlayerAcc, "DEATHS", 0 );
- INI_WriteInt( PlayerAcc, "VIP_LEVEL", 0 );
- INI_WriteInt( PlayerAcc, "LEVEL", 0 );
- INI_WriteInt( PlayerAcc, "MY_SKIN", 0 );
- INI_WriteInt( PlayerAcc, "MY_TIME", 12 );
- INI_WriteInt( PlayerAcc, "MY_WEATHER", 1 );
- INI_Close( PlayerAcc );
- SetPVarString( playerid, "Date", pDate );
- SetPVarInt( playerid, "Logged", 0 );
- GivePlayerMoney( playerid, 5000 );
- SetPlayerScore( playerid, GetPlayerScore( playerid ) + 15 );
- }
- }
- case DIALOG_REG_REQ:
- {
- if ( response ) cmd_register( playerid, "");
- if ( !response ) return 0;
- }
- case DIALOG_LOGIN: ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Contraseña",
- "{FFFFFF}Por favor escriba su contraseña.",
- "Entrar", "Salir");
- case DIALOG_LOG:
- {
- if ( response )
- ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Contraseña", "{FFFFFF}Por favor escriba su contraseña.","Entrar","Salir");
- }
- case DIALOG_LOG_DONE:
- {
- SpawnPlayer(playerid);
- resetvar@playerVehicles( playerid );
- return CallLocalFunction("loadPlayerVehicles", "d", playerid), 0x01;
- }
- case DIALOG_LOGIN2:
- {
- if ( !response ) return Kick( playerid );
- if ( response )
- {
- if ( strlen( inputtext ) == 0 )
- return ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "{FFFFFF}Contraseña", ""COL_RED"Error!\n\
- {FFFFFF}Por favor escriba su contraseña.",
- "Entrar", "Salir");
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ],
- Password[ 20 + 1 ]
- ;
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true, playerid );
- GetPVarString( playerid, "pPass", Password, sizeof Password );
- if ( !strcmp ( inputtext, Password, false ) )
- {
- new
- sTitle[ 21 + MAX_PLAYER_NAME + 25 ],
- sBoxInfo[ 512 ],
- Pdata[ 8 + 15 ],
- Pdata2[ 8 + 16 ]
- ;
- SetPVarInt( playerid, "Logged", 1 );
- format( PlayerFile , sizeof PlayerFile, "Cuentas/%s.ini", Encode( pName( playerid ) ) );
- INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
- GetPVarString( playerid, "Date", Pdata, 8 + 12 );
- GetPVarString( playerid, "ON", Pdata2, 8 + 16 );
- if ( GetPVarInt( playerid, "CGod" ) == 1 )
- {
- SetPVarInt( playerid, "CGod", 1);
- CGod[ playerid ] = SetTimerEx( "CarGodTimer", 200, true, "i", playerid );
- }
- if ( GetPVarInt( playerid, "God" ) == 1 )
- {
- SetPVarInt( playerid, "God", 1);
- God[ playerid ] = SetTimerEx( "GodTimer", 200, true, "i", playerid );
- }
- format( sTitle, sizeof sTitle, "{FFFFFF}Bienvenido "COL_LIGHTBLUE"%s{FFFFFF}!", pName( playerid ) );
- if ( GetPVarInt( playerid, "Level" ) == 0 )
- {
- format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}Estos son los datos de su cuenta:\n\n\
- {FFFFFF}Ranking: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Registrado: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}Ultima conexion: "COL_LIGHTBLUE"%s\n\n\
- {FFFFFF}Para ver las estadisticas use "COL_LIGHTBLUE"/estadisticas\n\
- {FFFFFF}Use "COL_LIGHTBLUE"/miscomandos{FFFFFF} para ver sus comandos.",
- GetPlayerLevelName( playerid ),
- GetPlayerVLevel( playerid ),
- GetPVarInt( playerid, "Score" ),
- Pdata,
- Pdata2 );
- }
- if ( GetPVarInt( playerid, "Level" ) > 1 )
- {
- format( sBoxInfo, sizeof sBoxInfo, "{FFFFFF}Estos son los datos de su cuenta:\n\n\
- {FFFFFF}Level: "COL_LIGHTBLUE"%s\n\
- {FFFFFF}VIP Level: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Score: "COL_LIGHTBLUE"%d\n\
- {FFFFFF}Registrado: "COL_LIGHTBLUE"%s\n\n",
- GetPlayerLevelName( playerid ),
- GetPlayerVLevel( playerid ),
- GetPVarInt( playerid, "Score" ),
- Pdata );
- format( sBoxInfo, sizeof sBoxInfo, "%s{FFFFFF}Para ver las estadisticas use "COL_LIGHTBLUE"/stats\n\
- {FFFFFF}Use "COL_LIGHTBLUE"/miscomandos{FFFFFF} para ver sus comandos.\n\
- "COL_RED"Nota administrativa:{FFFFFF}Use "COL_LIGHTBLUE"/acmds {FFFFFF}and "COL_LIGHTBLUE"/areglas {FFFFFF}para ver los comandos y reglas.",sBoxInfo);
- }
- ShowPlayerDialog(playerid, DIALOG_LOG_DONE, DIALOG_STYLE_MSGBOX, sTitle, sBoxInfo, "Ok", "");
- //SpawnPlayer(playerid);
- }
- else ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, ""COL_RED"Contraseña erronea...", ""COL_RED"Contraseña erronea!\n{FFFFFF}Intente de nuevo.", "Iniciar", "Salir");
- }
- }
- }
- return 1;
- }
- // fin comandos register
- public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
- {
- /*--------------------------------------------------
- * OnPlayerKeyStateChange
- * Params:
- - playerid
- - newkeys
- - oldkeys
- * Función:
- - Es empleada para tomar las posiciones del concesionario
- cuando éste se crea o se edita, se hace un cálculo de
- comparación básico para determinar xMin, yMin, xMax, yMax.
- --------------------------------------------------*/
- if( d@optionsEdit[playerid][0b100] )
- {
- if( newkeys & KEY_FIRE )
- ShowPlayerDialog( playerid, showMenuCreateDealer, DIALOG_STYLE_LIST, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición de concesionario."," 1)\tNombre del concesionario.\n 2)\tPosición del concesionario.\n", "Seleccionar.", "Cancelar.");
- else if( newkeys & KEY_YES )
- {
- static
- Float:f@positions[0b10][0b11];
- if( d@optionsEdit[playerid][0b100] == 1 )
- {
- GetPlayerPos( playerid, f@positions[0][0], f@positions[0][1], f@positions[0][0b10]);
- d@optionsEdit[playerid][0b100] = 2;
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Vaya a la segunda posición, pulse 'Y' cuando se encuentre listo.");
- }
- else if ( d@optionsEdit[playerid][0b100] == 2 )
- {
- GetPlayerPos( playerid, f@positions[1][0], f@positions[1][1], f@positions[1][0b10]);
- dealerLocations[d@optionsEdit[playerid][0]][f@maxX] = ((f@positions[0][0] > f@positions[1][0]) ? (f@positions[0][0]) : (f@positions[1][0]));
- dealerLocations[d@optionsEdit[playerid][0]][f@minX] = ((f@positions[0][0] < f@positions[1][0]) ? (f@positions[0][0]) : (f@positions[1][0]));
- dealerLocations[d@optionsEdit[playerid][0]][f@maxY] = ((f@positions[0][1] > f@positions[1][1]) ? (f@positions[0][1]) : (f@positions[1][1]));
- dealerLocations[d@optionsEdit[playerid][0]][f@minY] = ((f@positions[0][1] < f@positions[1][1]) ? (f@positions[0][1]) : (f@positions[1][1]));
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Coordenadas obtenidas correctamente.");
- if(d@optionsEdit[playerid][0b10] == 1) ShowPlayerDialog(playerid, showMenuDealerEdit, DIALOG_STYLE_LIST, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menu de edición.", "1)\t Nombre del concesionario.\n 2)\tPosicion del concesionario.\n 3)\tEliminar concesionario.\n -> Guardar cambios.", "Seleccionar.", "Cancelar.");
- else CallLocalFunction("OnDialogResponse","dddds", playerid, createDealerName, 1, 1, dealerLocations[d@optionsEdit[playerid][0]][sz@nameDealer]);
- }
- }
- }
- return 1;
- }
- //============================================================================//
- function:: verifyConnection()
- {
- /*--------------------------------------------------
- * verifiConnection
- *Params:
- - No params.
- * Función:
- - Realiza la conexión con la base de datos.
- - Verifica que la conexión se haya realizado correctamente.
- --------------------------------------------------*/
- cHandle = mysql_connect( DB_HOST, DB_USER, DB_DB, DB_PASSWORD );
- print("\n\t||=============[ wDealer/Ownership ]==============||\n");
- if( 0 <= mysql_ping(cHandle) < 0b10 ) {
- connectUpdate:
- mysql_debug( true );
- print("\t[mySQL] - Conexión con la base de datos '"#DB_DB"' realizada. \n\t\t\twDealership iniciado.");
- CallLocalFunction( "loadDealersData", #);
- }
- else {
- print("\t[mySQL - ¡Warning!] - La conexión con la base de datos '"#DB_DB"' no pudo verificarse. \n\t\t\tReintentando en 5 segundos.");
- sleep_ex( 0x271 << 0b11 );
- cHandle = mysql_connect( DB_HOST, DB_USER, DB_DB, DB_PASSWORD );
- if( 0 <= mysql_ping(cHandle) < 0b10 ) goto connectUpdate;
- else {
- print("\t[mySQL - ¡Warning!] - No se logro la conexión con la base de datos '"#DB_DB"'. \n\twDealership no puede iniciarse.");
- return SendRconCommand("exit"), false;
- }
- }
- print("\n\t||================================================||\n\n");
- return true;
- }
- //============================================================================//
- function:: OnQueryFinish( threadID, extraid )
- {
- /*--------------------------------------------------
- * OnQueryFinish
- * Params:
- - threadID
- - extraid
- * Función:
- - Este callback recibirá los datos que el plugin mysql nos
- retorne, ya sea por medio de la caché o simplemente al enviar
- querys vacías.
- - Aquí es donde se asignan lo datos del cargado de los vehículos
- tanto de usuarios como para los concesionarios.
- --------------------------------------------------*/
- static
- rows,
- fields,
- fetch[0b11110];
- cache_get_data(rows, fields);
- switch( threadID )
- {
- case empty@queryReceived: mysql_free_result();
- case dealerDataAssign:
- {
- if( rows )
- {
- for( new j = 0, i = 0; j <= rows-1; j++)
- {
- i = getNextVehicleID();
- paramsvDealer[ i ][ inumdID ] = strval ((cache_get_row(j, 0, fetch),fetch));
- cache_get_row(j, 1, paramsvDealer[ i ][ sCarName ] );
- paramsvDealer[ i ][ inumDealer ] = strval ((cache_get_row(j, 2, fetch),fetch));
- paramsvDealer[ i ][ iModel ] = strval ((cache_get_row(j, 3, fetch),fetch));
- paramsvDealer[ i ][ iPrice ] = strval ((cache_get_row(j, 4, fetch),fetch));
- paramsvDealer[ i ][ fdPos_X ] = floatstr ((cache_get_row(j, 5, fetch),fetch));
- paramsvDealer[ i ][ fdPos_Y ] = floatstr ((cache_get_row(j, 6, fetch),fetch));
- paramsvDealer[ i ][ fdPos_Z ] = floatstr ((cache_get_row(j, 7, fetch),fetch));
- paramsvDealer[ i ][ fdPos_R ] = floatstr ((cache_get_row(j,8, fetch),fetch));
- paramsvDealer[ i ][ inumID ] = CreateVehicle( paramsvDealer[i][iModel] , paramsvDealer[i][fdPos_X], paramsvDealer[i][fdPos_Y],
- paramsvDealer[i][fdPos_Z], paramsvDealer[i][fdPos_R], random(0xFF), random(0xFF), 5<<3);
- SetVehicleParamsEx(
- paramsvDealer[i][inumID],
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF,
- VEHICLE_PARAMS_OFF
- );
- }
- printf("[wDealer Debug] - Se han cargado %d vehículos de los concesionarios.", rows);
- }
- mysql_function_query(cHandle, "SELECT * FROM `dealerLocations` LIMIT "#MAX_DEALERS";", true, "OnQueryFinish", "d", dealerAssign);
- }
- case dealerAssign:
- {
- if( 0 < rows <= MAX_DEALERS )
- {
- for( new i = 0, j = 1; i < rows; i++, j++ )
- {
- dealerLocations[j][id@sqlid] = strval ((cache_get_row(i, 0, fetch),fetch));
- cache_get_row(i, 1, dealerLocations[j][sz@nameDealer]);
- dealerLocations[j][d@vehicles] = strval ((cache_get_row(i, 0b10, fetch),fetch));
- dealerLocations[j][f@maxX] = floatstr ((cache_get_row(i, 0b11, fetch),fetch));
- dealerLocations[j][f@minX] = floatstr ((cache_get_row(i,0b100, fetch),fetch));
- dealerLocations[j][f@maxY] = floatstr ((cache_get_row(i,0b101, fetch),fetch));
- dealerLocations[j][f@minY] = floatstr ((cache_get_row(i,0b110, fetch),fetch));
- }
- printf("[wDealer Debug] - Se han cargado %d concesionarios.", rows);
- }
- mysql_free_result();
- }
- case load@playerVehicles:
- {
- if( 0 < rows <= MAX_VEH_PER_PLAYER )
- {
- for( new i = 0; i < rows; i++ )
- {
- playerVehicle[extraid][i][idOwner] = extraid;
- playerVehicle[extraid][i][inumcID] = strval((cache_get_row(i, 0, fetch),fetch));
- cache_get_row(i, 1, playerVehicle[extraid][i][sCarOwner]);
- cache_get_row(i, 0b10, playerVehicle[extraid][i][sCarName]);
- playerVehicle[extraid][i][iModel] = strval ((cache_get_row(i, 0b11, fetch),fetch));
- playerVehicle[extraid][i][ipRepair] = strval ((cache_get_row(i, 0b100, fetch),fetch));
- playerVehicle[extraid][i][status] = ((strval ((cache_get_row(i, 0b101, fetch),fetch)) == 1 ) ? ( true ) : ( false ));
- playerVehicle[extraid][i][fPos_X] = floatstr ((cache_get_row(i, 0b110, fetch),fetch));
- playerVehicle[extraid][i][fPos_Y] = floatstr ((cache_get_row(i, 0b111, fetch),fetch));
- playerVehicle[extraid][i][fPos_Z] = floatstr ((cache_get_row(i,0b1000, fetch),fetch));
- playerVehicle[extraid][i][fPos_R] = floatstr ((cache_get_row(i,0b1001, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pEngine] = strval ((cache_get_row(i,0b1010, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pLights] = strval ((cache_get_row(i,0b1011, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pAlarm] = strval ((cache_get_row(i,0b1100, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pLock] = strval ((cache_get_row(i,0b1101, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pBonnet] = strval ((cache_get_row(i,0b1110, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pBoot] = strval ((cache_get_row(i,0b1111, fetch),fetch));
- playerVehicle[extraid][i][paramsVeh][pObjective] = strval ((cache_get_row(i, 0x10, fetch),fetch));
- playerVehicle[extraid][i][damageVeh][dHealth] = floatstr ((cache_get_row(i, 0x11, fetch),fetch));
- playerVehicle[extraid][i][damageVeh][dPanels] = strval ((cache_get_row(i, 0x12, fetch),fetch));
- playerVehicle[extraid][i][damageVeh][dDoors] = strval ((cache_get_row(i, 0x13, fetch),fetch));
- playerVehicle[extraid][i][damageVeh][dLights] = strval ((cache_get_row(i, 0x14, fetch),fetch));
- playerVehicle[extraid][i][damageVeh][dTires] = strval ((cache_get_row(i, 0x15, fetch),fetch));
- playerVehicle[extraid][i][mods][mColores][0] = strval ((cache_get_row(i, 0x16, fetch),fetch));
- playerVehicle[extraid][i][mods][mColores][1] = strval ((cache_get_row(i, 0x17, fetch),fetch));
- playerVehicle[extraid][i][mods][mSpoiler] = strval ((cache_get_row(i, 0x18, fetch),fetch));
- playerVehicle[extraid][i][mods][mHood] = strval ((cache_get_row(i, 0x19, fetch),fetch));
- playerVehicle[extraid][i][mods][mRoof] = strval ((cache_get_row(i, 0x1A, fetch),fetch));
- playerVehicle[extraid][i][mods][mSideskirts][0] = strval ((cache_get_row(i, 0x1B, fetch),fetch));
- playerVehicle[extraid][i][mods][mSideskirts][1] = strval ((cache_get_row(i, 0x1C, fetch),fetch));
- playerVehicle[extraid][i][mods][mNitro] = strval ((cache_get_row(i, 0x1D, fetch),fetch));
- playerVehicle[extraid][i][mods][mLamps] = strval ((cache_get_row(i, 0x1E, fetch),fetch));
- playerVehicle[extraid][i][mods][mExhaust] = strval ((cache_get_row(i, 0x1F, fetch),fetch));
- playerVehicle[extraid][i][mods][mWheels] = strval ((cache_get_row(i, 0x20, fetch),fetch));
- playerVehicle[extraid][i][mods][mStereo] = strval ((cache_get_row(i, 0x21, fetch),fetch));
- playerVehicle[extraid][i][mods][mHidraulics] = strval ((cache_get_row(i, 0x22, fetch),fetch));
- playerVehicle[extraid][i][mods][mPaintjob] = strval ((cache_get_row(i, 0x23, fetch),fetch));
- playerVehicle[extraid][i][mods][mBullbar] = strval ((cache_get_row(i, 0x24, fetch),fetch));
- playerVehicle[extraid][i][mods][mRealBullbars] = strval ((cache_get_row(i, 0x25, fetch),fetch));
- playerVehicle[extraid][i][mods][mFrontSign] = strval ((cache_get_row(i, 0x26, fetch),fetch));
- playerVehicle[extraid][i][mods][mFrontBullbars] = strval ((cache_get_row(i, 0x27, fetch),fetch));
- playerVehicle[extraid][i][mods][mBullbars] = strval ((cache_get_row(i, 0x28, fetch),fetch));
- playerVehicle[extraid][i][mods][mRearBumper] = strval ((cache_get_row(i, 0x29, fetch),fetch));
- playerVehicle[extraid][i][mods][mVents][0] = strval ((cache_get_row(i, 0x2A, fetch),fetch));
- playerVehicle[extraid][i][mods][mVents][1] = strval ((cache_get_row(i, 0x2B, fetch),fetch));
- playerVehicle[extraid][i][mods][mFrontBumper] = strval ((cache_get_row(i, 0x2C, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmas][0] = strval ((cache_get_row(i, 0x2D, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tMuniciones][0] = strval ((cache_get_row(i, 0x2E, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmas][1] = strval ((cache_get_row(i, 0x2F, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tMuniciones][1] = strval ((cache_get_row(i, 0x30, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmas][0b10] = strval ((cache_get_row(i, 0x31, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tMuniciones][0b10] = strval ((cache_get_row(i, 0x32, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmas][0b11] = strval ((cache_get_row(i, 0x33, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tMuniciones][0b11] = strval ((cache_get_row(i, 0x34, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmas][0b100] = strval ((cache_get_row(i, 0x35, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tMuniciones][0b100] = strval ((cache_get_row(i, 0x36, fetch),fetch));
- playerVehicle[extraid][i][Maletero][tArmadura] = floatstr ((cache_get_row(i, 0x37, fetch),fetch));
- if( playerVehicle[extraid][i][status] )
- CallLocalFunction("createPlayerVehicle", "dd", extraid, i );
- printf("[wDealer:] Se ha cargado el auto N°%d de %s. Este %s.", i+1, playerVehicle[extraid][i][sCarOwner], ( ( playerVehicle[extraid][i][status] ) ? ( "a sido creado correctamente" ) : ( "no a sido creado" )));
- }
- }
- mysql_free_result();
- }
- case sql@insertID:
- {
- for( new i = GetMaxPlayers()-1; i > -1; --i )
- {
- if( isvehicle@playerProperty( i, playerVehicle[i][extraid][icnumID] ) )
- playerVehicle[i][extraid][inumcID] = mysql_insert_id(cHandle);
- else
- continue;
- }
- }
- case sql_d@insertID:
- {
- paramsvDealer[extraid][inumdID] = mysql_insert_id(cHandle);
- CallLocalFunction("save@DealersData", #);
- }
- case sql@dealerInsertID:
- {
- dealerLocations[extraid][id@sqlid] = mysql_insert_id(cHandle);
- CallLocalFunction("save@dealerLocations", #);
- }
- default: mysql_free_result();
- }
- mysql_free_result();
- }
- //============================================================================//
- function:: loadDealersData()
- {
- /*--------------------------------------------------
- * loadDealersData
- *Params:
- - No params.
- * Función:
- - Envía la consulta que seleccionará todos los vehículos
- de los concesionarios y los integrará en el caché para después
- manipularlos y así crear los vehículos en OnQueryFinish de acuerdo
- a la información obtenida.
- --------------------------------------------------*/
- static
- d@iterator;
- d@iterator = -1;
- for( new i; i < MAX_DEALERS; i++ )
- {
- while( dealerLoc:++d@iterator < dealerLoc ) {
- dealerLocations[i][dealerLoc:d@iterator] = 0;
- }
- }
- mysql_function_query(cHandle, "SELECT * FROM `carsDealers` LIMIT "#MAX_DEALER_VEHICLES"", true, "OnQueryFinish", "d", dealerDataAssign);
- return 0x01;
- }
- //============================================================================//
- function:: save@DealersData()
- {
- /*--------------------------------------------------
- * save@DealersData
- * Params:
- - No params.
- * Función:
- - Esta función mediante un bucle formateará y ejecutará las
- consultas correspondientes para almacenar todos los vehículos
- de los concesionarios
- --------------------------------------------------*/
- static
- query[0x100],
- count;
- count = 0;
- for( new i = MAX_VEHICLES-1; i > 0; --i)
- {
- if( paramsvDealer[ i ][ inumDealer ] <= 0 ) continue;
- else
- {
- mysql_format( cHandle, query, "UPDATE `carsDealers` SET `CarName` = '%e', `DealerCar` = %d, `CarModel` = %d,`CarPrice` = %d, `CarPosX` = %f, `CarPosY` = %f, `CarPosZ` = %f, `CarRot` = %f WHERE `ID_CarDealer` = %d",
- paramsvDealer[i][sCarName], paramsvDealer[i][inumDealer], paramsvDealer[i][iModel], paramsvDealer[i][iPrice], paramsvDealer[i][fdPos_X],
- paramsvDealer[i][fdPos_Y], paramsvDealer[i][fdPos_Z], paramsvDealer[i][fdPos_R], paramsvDealer[i][inumdID]);
- mysql_function_query( cHandle, query, false, "OnQueryFinish", "d", empty@queryReceived);
- count ++;
- }
- }
- CallLocalFunction("save@dealerLocations", #);
- return printf("[wDealer]: Se han guardado %d vehículos de los concesionarios", count);
- }
- //============================================================================//
- function:: loadPlayerVehicles( playerid )
- {
- /*--------------------------------------------------
- * loadPlayerVehicles
- * Params:
- - playerid
- * Función:
- - Enviará la consulta correspondiente para cargar los
- vehículos del usuario determinado ( playerid ), asignando los
- datos obtenidos a la caché para después ser manipulados en
- OnQueryFinish y así poder crear los vehículos de usuario
- --------------------------------------------------*/
- static
- sz@Query[0b1010101];
- mysql_format( cHandle, sz@Query, "SELECT * FROM `uservehicles` WHERE `OwnerName` = '%e'", getPlayerName( playerid, true ));
- return mysql_function_query( cHandle, sz@Query, true, "OnQueryFinish", "dd", load@playerVehicles, playerid), 0x01;
- }
- //============================================================================//
- function:: createPlayerVehicle( playerid, vehicleID )
- {
- /*--------------------------------------------------
- * createPlayerVehicle
- * Params:
- - playerid
- - vehicleID
- * Función:
- - Se ejecutará después de asignar los datos a las variables especifícas
- para crear el vehículo & asignarle el Tuning correspondiente además de
- establecer el valor de las puertas al vehículo.
- --------------------------------------------------*/
- if( IsPlayerConnected( playerid ) && playerVehicle[playerid][vehicleID][status] )
- {
- playerVehicle[playerid][vehicleID][icnumID] = CreateVehicle( playerVehicle[playerid][vehicleID][iModel], playerVehicle[playerid][vehicleID][fPos_X], playerVehicle[playerid][vehicleID][fPos_Y], playerVehicle[playerid][vehicleID][fPos_Z],
- playerVehicle[playerid][vehicleID][fPos_R], playerVehicle[playerid][vehicleID][mods][mColores][0], playerVehicle[playerid][vehicleID][mods][mColores][1], -1);
- if( playerVehicle[playerid][vehicleID][mods][mSpoiler] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mSpoiler]);
- if( playerVehicle[playerid][vehicleID][mods][mHood] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mHood]);
- if( playerVehicle[playerid][vehicleID][mods][mRoof] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mRoof]);
- if( playerVehicle[playerid][vehicleID][mods][mSideskirts][0]!= -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mSideskirts][0]);
- if( playerVehicle[playerid][vehicleID][mods][mSideskirts][1]!= -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mSideskirts][1]);
- if( playerVehicle[playerid][vehicleID][mods][mNitro] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mNitro]);
- if( playerVehicle[playerid][vehicleID][mods][mLamps] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mLamps]);
- if( playerVehicle[playerid][vehicleID][mods][mExhaust] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mExhaust]);
- if( playerVehicle[playerid][vehicleID][mods][mWheels] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mWheels]);
- if( playerVehicle[playerid][vehicleID][mods][mStereo] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mStereo]);
- if( playerVehicle[playerid][vehicleID][mods][mHidraulics] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mHidraulics]);
- if( playerVehicle[playerid][vehicleID][mods][mBullbar] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mBullbar]);
- if( playerVehicle[playerid][vehicleID][mods][mRealBullbars] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mRealBullbars]);
- if( playerVehicle[playerid][vehicleID][mods][mFrontSign] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mFrontSign]);
- if( playerVehicle[playerid][vehicleID][mods][mFrontBullbars]!= -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mFrontBullbars]);
- if( playerVehicle[playerid][vehicleID][mods][mBullbars] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mBullbars]);
- if( playerVehicle[playerid][vehicleID][mods][mRearBumper] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mRearBumper]);
- if( playerVehicle[playerid][vehicleID][mods][mVents][0] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mVents][0]);
- if( playerVehicle[playerid][vehicleID][mods][mVents][1] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mVents][1]);
- if( playerVehicle[playerid][vehicleID][mods][mFrontBumper] != -1 ) AddVehicleComponent(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mFrontBumper]);
- if( playerVehicle[playerid][vehicleID][mods][mPaintjob] != -1 ) ChangeVehiclePaintjob(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mPaintjob]);
- ChangeVehicleColor(playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][mods][mColores][0], playerVehicle[playerid][vehicleID][mods][mColores][1]);
- SetVehicleHealth( playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][damageVeh][dHealth]);
- UpdateVehicleDamageStatus( playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][damageVeh][dPanels],
- playerVehicle[playerid][vehicleID][damageVeh][dDoors],
- playerVehicle[playerid][vehicleID][damageVeh][dLights],
- playerVehicle[playerid][vehicleID][damageVeh][dTires]);
- SetVehicleParamsEx( playerVehicle[playerid][vehicleID][icnumID], playerVehicle[playerid][vehicleID][paramsVeh][pEngine], playerVehicle[playerid][vehicleID][paramsVeh][pLights],
- playerVehicle[playerid][vehicleID][paramsVeh][pAlarm], playerVehicle[playerid][vehicleID][paramsVeh][pLock],
- playerVehicle[playerid][vehicleID][paramsVeh][pBonnet], playerVehicle[playerid][vehicleID][paramsVeh][pBoot],
- playerVehicle[playerid][vehicleID][paramsVeh][pObjective]);
- return true;
- }
- return false;
- }
- //============================================================================//
- function:: createplayer@vehiclePurchased( playerid, extraid )
- {
- /*--------------------------------------------------
- * createplayer@vehiclePurchased
- * Params:
- - playerid
- - extraid
- * Función:
- - Esta función creará y establecerá las variables correspondientes
- a un usuario ( playerid ) después de comprar un vehículo de algún
- concesionario, donde 'extraid' será el slot que ocupará el vehículo
- en el usuario.
- - Enviará la consulta correspondiente para almacenar el vehículo en
- la tabla respectiva.
- --------------------------------------------------*/
- if( ( IsPlayerConnected( playerid ) & IsPlayerInAnyVehicle( playerid ) ) && ( 0 < paramsvDealer[ GetPlayerVehicleID(playerid) ][ inumDealer ] <= MAX_DEALERS ) )
- {
- static
- s@query[0x12C];
- strmid( playerVehicle[playerid][extraid][sCarName], paramsvDealer[obs@Venta[playerid][1]][sCarName], 0, strlen(paramsvDealer[obs@Venta[playerid][1]][sCarName]), 30);
- strmid( playerVehicle[playerid][extraid][sCarOwner], getPlayerName( playerid, true ), 0, strlen(getPlayerName( playerid, true )), MAX_PLAYER_NAME );
- playerVehicle[playerid][extraid][idOwner] = playerid;
- playerVehicle[playerid][extraid][iModel] = paramsvDealer[obs@Venta[playerid][1]][iModel];
- playerVehicle[playerid][extraid][ipRepair] = ( ( 0b101 * paramsvDealer[obs@Venta[playerid][1]][iPrice] ) / 0x64 ); // 0x64 = 100, 0b101 = 5
- playerVehicle[playerid][extraid][status] = true;
- playerVehicle[playerid][extraid][fPos_X] = 560.9253;
- playerVehicle[playerid][extraid][fPos_Y] = -1262.4637;
- playerVehicle[playerid][extraid][fPos_Z] = 17.2422;
- playerVehicle[playerid][extraid][fPos_R] = 26.3302;
- playerVehicle[playerid][extraid][paramsVeh][pEngine] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][paramsVeh][pLights] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][paramsVeh][pAlarm] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][paramsVeh][pLock] = VEHICLE_PARAMS_ON;
- playerVehicle[playerid][extraid][paramsVeh][pBonnet] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][paramsVeh][pBoot] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][paramsVeh][pObjective] = VEHICLE_PARAMS_OFF;
- playerVehicle[playerid][extraid][damageVeh][dHealth] = float( 0x3E8 );
- playerVehicle[playerid][extraid][mods][mColores][0] = random(0xFF);
- playerVehicle[playerid][extraid][mods][mColores][1] = random(0xFF);
- playerVehicle[playerid][extraid][icnumID] = CreateVehicle( playerVehicle[playerid][extraid][iModel], playerVehicle[playerid][extraid][fPos_X], playerVehicle[playerid][extraid][fPos_Y],
- playerVehicle[playerid][extraid][fPos_Z], playerVehicle[playerid][extraid][fPos_R], playerVehicle[playerid][extraid][mods][mColores][0],
- playerVehicle[playerid][extraid][mods][mColores][1], -1);
- GivePlayerMoney(playerid, ((~paramsvDealer[obs@Venta[playerid][1]][iPrice])+1));
- PutPlayerInVehicle( playerid, playerVehicle[playerid][extraid][icnumID], 0);
- mysql_format( cHandle, s@query, "INSERT INTO `userVehicles` ( `OwnerName`, `CarName`, `carModel`, `cReparacion`, `Status`, `Pos_X`, `Pos_Y`, `Pos_Z`, `Pos_R`, `dHealth`, `Color1`, `Color2` ) "\
- "VALUES ( '%e', '%e', %d, %d, %d, %f, %f, %f, %f, %f, %d, %d )",
- playerVehicle[playerid][extraid][sCarOwner], playerVehicle[playerid][extraid][sCarName], playerVehicle[playerid][extraid][iModel], playerVehicle[playerid][extraid][ipRepair],
- (( playerVehicle[playerid][extraid][status] )?( 1 ):( 0 )),
- playerVehicle[playerid][extraid][fPos_X], playerVehicle[playerid][extraid][fPos_Y], playerVehicle[playerid][extraid][fPos_Z], playerVehicle[playerid][extraid][fPos_R],
- playerVehicle[playerid][extraid][damageVeh][dHealth], playerVehicle[playerid][extraid][mods][mColores][0], playerVehicle[playerid][extraid][mods][mColores][1]);
- mysql_function_query( cHandle, s@query, false, "OnQueryFinish", "dd", sql@insertID, extraid);
- format( s@query, sizeof s@query, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Felicidades %s, has comprado un %s por $%d.00. ¡Disfrutalo!",getPlayerName(playerid, true), paramsvDealer[obs@Venta[playerid][1]][sCarName], paramsvDealer[obs@Venta[playerid][1]][iPrice]);
- SendClientMessage( playerid, -1, s@query);
- TogglePlayerControllable( playerid, true );
- SetVehicleParamsForAll( obs@Venta[ playerid ][ 1 ], false, false );
- obs@Venta[ playerid ][ 1 ] = -1;
- return 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en ningún vehículo de pruebas"), 0x01;
- }
- public OnQueryError( errorid, error[], callback[], query[], connectionHandle )
- {
- printf("\t\t[ERROR:%d]\nError:%s\nQUERY:\n%s\n, connectionHandle: %d\nCallback:%s", errorid, error, query, connectionHandle, callback);
- return 1;
- }
- //============================================================================//
- function:: SetVehicleParamsForAll( carid, objective, doorslocked )
- {
- /*--------------------------------------------------
- * SetVehicleParamsForAll
- * Params:
- - carid
- - objective
- - doorslocked
- * Función:
- - Establecerá a el vehículo correspondiente (carid) el
- valor correspondiente en la parte seleccionada.
- --------------------------------------------------*/
- for( new i = GetMaxPlayers()-1; i > -1; --i )
- SetVehicleParamsForPlayer(carid, i, objective, doorslocked);
- }
- //============================================================================//
- function:: disable@vehicleAlarm( vehicleid )
- {
- /*--------------------------------------------------
- * disable@vehicleAlarm
- * Params:
- - vehicleid
- * Función:
- - Desactiva/apaga la alarma activa del vehículo
- insertado ( vehicleid ).
- --------------------------------------------------*/
- static
- engine,
- lights,
- alarm,
- doors,
- bonnet,
- boot,
- objective;
- GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx( vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
- }
- //============================================================================//
- CMD:edealerloc( playerid, params[] )
- {
- /*--------------------------------------------------
- * edealerloc ( Comando ).
- * Params:
- - dealerid
- * Función:
- - Muestra el menú de edición de datos del
- concesionario insertado ( dealerid ).
- --------------------------------------------------*/
- if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /edealerloc [dealerid]"), 0x01;
- else
- {
- static
- sz@message[0x7D];
- d@optionsEdit[playerid][0] = strval(params);
- if(0 < d@optionsEdit[playerid][0] <= MAX_DEALERS+1)
- {
- format(sz@message, sizeof(sz@message), "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario N°%d.", d@optionsEdit[playerid][0]);
- ShowPlayerDialog(playerid, showMenuDealerEdit, DIALOG_STYLE_LIST, sz@message, "1)\t Nombre del concesionario.\n 2)\tPosicion del concesionario.\n 3)\tEliminar concesionario.\n -> Guardar cambios.", "Seleccionar.", "Cancelar.");
- return SendClientMessage(playerid, -1, sz@message), 0x01;
- }
- else return SendClientMessage(playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} La ID del concesionario debe ir del 1 al "#MAX_DEALERS+1"."), 0x01;
- }
- }
- //============================================================================//
- CMD:createvdealer( playerid, params[] )
- {
- /*--------------------------------------------------
- * createvdealer ( comando )
- * Params:
- - modelid | nombre
- - concesionario
- - precio/costo
- * Función:
- - Rellenando los parámetros del comando, se creará un vehículo
- del modelo deseado para el concesionario especificado con el precio
- establecido, además de insertarlo directamente en la tabla.
- --------------------------------------------------*/
- if( isnull( params ) )
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /createvdealer [modelid|nombre] [concesionario] [precio]"), 1;
- else
- {
- static
- sz@dMod[0b11001],
- sz@sPart[0x100],
- d@nextID;
- if( !sscanf( params, "s[25]s[50]", sz@dMod, sz@sPart))
- {
- d@nextID = getNextVehicleID();
- paramsvDealer[d@nextID][iModel] = ( ( isNumeric( sz@dMod ) ) ? ( strval( sz@dMod ) ) : ( getVehicleModelbyName( sz@dMod ) ) );
- if( 0x190 <= paramsvDealer[d@nextID][iModel] <= 0x263 )
- {
- if( !sscanf( sz@sPart, "dd", paramsvDealer[d@nextID][inumDealer], paramsvDealer[d@nextID][iPrice] ) )
- {
- if( 0 < paramsvDealer[d@nextID][inumDealer] <= MAX_DEALERS )
- {
- if(IsPlayerInArea(playerid, dealerLocations[paramsvDealer[d@nextID][inumDealer]][f@maxX], dealerLocations[paramsvDealer[d@nextID][inumDealer]][f@maxY], dealerLocations[paramsvDealer[d@nextID][inumDealer]][f@minX], dealerLocations[paramsvDealer[d@nextID][inumDealer]][f@minY]))
- {
- GetPlayerPos( playerid, paramsvDealer[d@nextID][fdPos_X], paramsvDealer[d@nextID][fdPos_Y], paramsvDealer[d@nextID][fdPos_Z]);
- GetPlayerFacingAngle( playerid, paramsvDealer[d@nextID][fdPos_R]);
- paramsvDealer[d@nextID][inumID] = CreateVehicle( paramsvDealer[d@nextID][iModel], paramsvDealer[d@nextID][fdPos_X], paramsvDealer[d@nextID][fdPos_Y], paramsvDealer[d@nextID][fdPos_Z], paramsvDealer[d@nextID][fdPos_R], random(0xFF), random(0xFF), -1);
- strmid( paramsvDealer[d@nextID][sCarName], getVehicleNamebyID(paramsvDealer[d@nextID][inumID]), 0, strlen(getVehicleNamebyID(paramsvDealer[d@nextID][inumID])), 0b11001);
- mysql_format( cHandle, sz@sPart, "INSERT INTO `carsDealers`( `CarName`, `DealerCar`, `CarModel`, `CarPrice`, `CarPosX`, `CarPosY`, `CarPosZ`, `CarRot`) VALUES ('%e', '%d', '%d', '%d', '%f', '%f', '%f', '%f')",
- getVehicleNamebyID(paramsvDealer[d@nextID][inumID]), paramsvDealer[d@nextID][inumDealer], paramsvDealer[d@nextID][iModel], paramsvDealer[d@nextID][iPrice],
- paramsvDealer[d@nextID][fdPos_X], paramsvDealer[d@nextID][fdPos_Y], paramsvDealer[d@nextID][fdPos_Z], paramsvDealer[d@nextID][fdPos_R]);
- mysql_function_query( cHandle, sz@sPart, false, "OnQueryFinish", "dd", sql_d@insertID, d@nextID);
- return 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en el concesionario."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} ID de concesionario inválida [ 1 - 10 ]"), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /createvdealer [modelid|nombre] [concesionario] [precio]"), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modelo de vehículo inválido. Inserte un ID | Nombre correcto."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /createvdealer [modelid|nombre] [concesionario] [precio]"), 0x01;
- }
- }
- //============================================================================//
- CMD:delvdealer( playerid, params[] )
- {
- /*--------------------------------------------------
- * delvdealer ( comando )
- * Params:
- - carid
- * Función:
- - Elimina un vehículo del concesionario de acuerdo a la ID que tenga
- InGame, verificando sí es o no de concesionario y sú existencia en
- la tabla correspondiente.
- --------------------------------------------------*/
- if( IsPlayerAdmin( playerid ) )
- {
- if( isnull( params ) )
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /delvdealer [carid]"), 1;
- else
- {
- static
- d@carID,
- Float:f@vehPos[0b11],
- sz@query[0b111000];
- if( 0 < paramsvDealer[( d@carID = strval(params), d@carID )][ inumDealer ] <= MAX_DEALERS )
- {
- if( IsPlayerInRangeOfPoint ( playerid, float(0b11), (GetVehiclePos(d@carID, f@vehPos[0], f@vehPos[1], f@vehPos[0b10]), f@vehPos[0]), f@vehPos[1], f@vehPos[0b10] ) )
- {
- static
- i@iterator;
- i@iterator = -1;
- mysql_format( cHandle, sz@query, "DELETE FROM `carsDealers` WHERE `ID_CarDealer` = %d", paramsvDealer[d@carID][inumdID]);
- mysql_function_query( cHandle, sz@query, false, "OnQueryFinish", "d", empty@queryReceived);
- DestroyVehicle( d@carID );
- while( dealerEnum:++i@iterator < dealerEnum ) {
- paramsvDealer[d@carID][dealerEnum:i@iterator] = -1;
- }
- format(sz@query, sizeof sz@query, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has eliminado el vehículo ID:%d del concesionario.", d@carID);
- return SendClientMessage( playerid, -1, sz@query), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Tienes que estar cerca del vehículo a elminar."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has insertado la id de un vehículo inválida."), 0x01;
- }
- }
- else
- return 0;
- }
- //============================================================================//
- CMD:buyvehicle( playerid )
- {
- /*--------------------------------------------------
- * buyvehicle ( comando )
- * Params:
- - No params.
- * Función:
- - Al ejecutar este comando compramos el vehículo
- que nos encontremos observando, nos asignará las variables
- y creará un vehículo en la entrada de grotty, en fín,
- el vehículo será nuestro.
- --------------------------------------------------*/
- if( ( IsPlayerConnected( playerid ) & IsPlayerInAnyVehicle( playerid ) ) && ( 0 < paramsvDealer[ GetPlayerVehicleID(playerid) ][ inumDealer ] <= MAX_DEALERS ) )
- {
- if( paramsvDealer[obs@Venta[playerid][1]][iPrice] <= GetPlayerMoney( playerid ) )
- {
- static
- d@emptySlot;
- d@emptySlot = getslot@playerEmpty( playerid );
- if( d@emptySlot != -1 )
- return CallLocalFunction("createplayer@vehiclePurchased", "dd", playerid, d@emptySlot), 0x01;
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Ya tienes todos los slots para vehículos ocupados"), cmd_salirvcar(playerid), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No posees suficiente dinero."), cmd_salirvcar(playerid), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en ningún vehículo de pruebas"), 0x01;
- }
- //============================================================================//
- CMD:venderveh( playerid, params[] )
- {
- /*--------------------------------------------------
- * venderveh ( comando )
- * Params:
- - Concesionario | Usuario
- - playerid
- - veh(slot)
- - precio
- * Función:
- - Con este comando venderás tú vehículo al concesionario
- o a algún usuario, con la venta al concesionario obtendrás
- el 75% del costo total gastado en el mismo, y con el usuario
- obtendrás lo que hayas llenado en el parámetro 'precio'.
- --------------------------------------------------*/
- if( isnull( params ) )
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /venderveh [concesionario] || [usuario] [playerID] [veh(slot)] [precio]"), 1;
- else
- {
- if( strcmp( params, "Concesionario", true ) == 0 )
- {
- if((( IsPlayerInAnyVehicle( playerid ) & isvehicle@playerProperty(playerid, GetPlayerVehicleID(playerid)) ) && ( getslot@playerVehicle(playerid, GetPlayerVehicleID(playerid)) != -1 )))
- {
- static
- d@iterator,
- d@slotVehicle,
- d@payVehicle,
- sz@message[0x7D];
- d@iterator = -1, d@slotVehicle = 1;
- d@slotVehicle = getslot@playerVehicle(playerid, GetPlayerVehicleID(playerid));
- d@payVehicle = floatround(floatmul(float(playerVehicle[playerid][d@slotVehicle][ipRepair]), 0b1111), floatround_round); // 0b1111 = 15
- GivePlayerMoney( playerid, d@payVehicle );
- mysql_format( cHandle, sz@message, "DELETE FROM `userVehicles` WHERE `Car_ID` = %d", playerVehicle[playerid][d@slotVehicle][inumcID]);
- mysql_function_query( cHandle, sz@message, false, "OnQueryFinish", "d", empty@queryReceived);
- DestroyVehicle( playerVehicle[playerid][d@slotVehicle][icnumID] );
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} ¡Felicidades! %s, has vendido tu %s por $%d.00.", getPlayerName(playerid, true), playerVehicle[playerid][d@slotVehicle][sCarName], d@payVehicle);
- while( carEnum:++d@iterator < carEnum ) {
- playerVehicle[playerid][d@slotVehicle][carEnum:d@iterator] = -1;
- }
- return SendClientMessage( playerid, -1, sz@message ), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Tienes que estar en un vehículo propio para ejecutar esta acción."), 0x01;
- }
- else
- {
- static
- d@tmp[0b1000],
- d@arrValues[0b11],
- Float:f@posArr[0b11],
- sz@message[0x4B];
- if( !( sscanf( params, "s[8]udd", d@tmp, d@arrValues[0], d@arrValues[1], d@arrValues[0b10] ) ) )
- {
- if((playerid != d@arrValues[0])&&(IsPlayerConnected(d@arrValues[0]) & IsPlayerInRangeOfPoint(d@arrValues[0], 10.0, (GetPlayerPos(playerid, f@posArr[0], f@posArr[1], f@posArr[0b10]), f@posArr[0]),f@posArr[1],f@posArr[0b10])))
- {
- if((( -1 < d@arrValues[1] < MAX_VEH_PER_PLAYER ) & ( playerVehicle[playerid][d@arrValues[1]][icnumID] != -1 )))
- {
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} El usuario [%d] %s te ofrece sú %s por $%d.", playerid, getPlayerName(playerid, true), playerVehicle[playerid][d@arrValues[1]][sCarName], d@arrValues[0b10]);
- SendClientMessage( d@arrValues[0], -1, sz@message);
- SendClientMessage( d@arrValues[0], -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Utiliza '/offreceived 1' para comprar el vehículo o '/offreceived 0' para rechazarlo.");
- obs@Venta[d@arrValues[0]][0] = d@arrValues[1];
- obs@Venta[d@arrValues[0]][1] = d@arrValues[0b10];
- obs@Venta[d@arrValues[0]][0b10] = playerid;
- obs@Venta[d@arrValues[0]][0b11] = d@arrValues[1];
- return 1;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} El slot del vehículo a ofertar es inválido."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has insertado una ID de usuario inválida"), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: /venderveh usuario [ID] [veh] [precio]"), 0x01;
- }
- }
- }
- //============================================================================//
- CMD:offerveh( playerid, params[] )
- {
- /*--------------------------------------------------
- * offerveh ( comando )
- * Params:
- - 0
- - 1
- * Función:
- - Con este comando aceptas/rechazas la compra del
- vehículo que un usuario se encuentre ofreciendote.
- --------------------------------------------------*/
- if( obs@Venta[playerid][1] != -1 )
- {
- if( isnull( params ) )
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/offerveh [ 0 | 1 ]' ( rechazar | aceptar )."), 0x01;
- else
- {
- static
- sz@message[0x4B],
- d@emptySlot,
- Float:f@posArr[0b11],
- d@iterator;
- switch( strval( params ) )
- {
- case 0:
- {
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has cancelado la oferta de venta que tenias");
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} [%d] %s ha cancelado el ofrecimiento que le realizaste", playerid, getPlayerName(playerid, true));
- SendClientMessage( obs@Venta[playerid][0b10], -1, sz@message);
- obs@Venta[playerid][0] = -1, obs@Venta[playerid][1] = -1, obs@Venta[playerid][0b10] = -1, obs@Venta[playerid][0b11] = -1;
- return 1;
- }
- case 1:
- {
- d@emptySlot = getslot@playerEmpty( playerid );
- if( -1 < d@emptySlot < MAX_VEH_PER_PLAYER )
- {
- if( obs@Venta[playerid][1] <= GetPlayerMoney( playerid ) )
- { //0b1010 = 10
- if((IsPlayerConnected(obs@Venta[playerid][0b10]) & IsPlayerInRangeOfPoint(obs@Venta[playerid][0b10], float(0b1010), (GetPlayerPos(playerid,f@posArr[0],f@posArr[1],f@posArr[0b10]),f@posArr[0]),f@posArr[1],f@posArr[0b10])))
- {
- d@iterator = -1;
- while( carEnum:++d@iterator < carEnum )
- {
- playerVehicle[playerid][d@emptySlot][carEnum:d@iterator] = playerVehicle[obs@Venta[playerid][0b10]][obs@Venta[playerid][0]][carEnum:d@iterator];
- playerVehicle[obs@Venta[playerid][0b10]][obs@Venta[playerid][0]][carEnum:d@iterator] = -1;
- }
- strmid( playerVehicle[playerid][d@emptySlot][sCarOwner], getPlayerName(playerid, true), 0, strlen(getPlayerName(playerid, true)), 0x1E); // 30
- playerVehicle[playerid][d@emptySlot][idOwner] = playerid;
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Felicitaciones %s, has comprado el vehículo.", getPlayerName( playerid, true ) );
- SendClientMessage( playerid, -1, sz@message);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s ha aceptado tu oferta de venta.", getPlayerName( playerid, true ));
- SendClientMessage(obs@Venta[playerid][0b10], -1, sz@message);
- GivePlayerMoney(playerid, ((~obs@Venta[playerid][1])+1));
- return GivePlayerMoney( obs@Venta[playerid][0b10], obs@Venta[playerid][1]), 0x01;
- }
- else
- return ( obs@Venta[playerid][0] = -1, obs@Venta[playerid][1] = -1,
- obs@Venta[playerid][0b10] = -1, obs@Venta[playerid][0b11] = -1 ),
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} La transacción finalizo debido a la falta del vendedor."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No tienes el monto requerido para la transacción."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No tienes ningún slot para vehículo disponible."), 0x01;
- }
- default: return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/offreceived [ 0 | 1 ]' ( rechazar | aceptar )."), 0x01;
- }
- return 1;
- }
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No te han ofertado ningún vehículo."), 0x01;
- }
- //============================================================================//
- CMD:salirvcar( playerid )
- {
- /*--------------------------------------------------
- * salirvcar ( comando )
- * Params:
- - No params.
- * Función:
- - Con este comando te bajas de un vehículo de
- concesionario sin comprarle.
- --------------------------------------------------*/
- if( ( IsPlayerConnected( playerid ) & IsPlayerInAnyVehicle( playerid ) ) && ( 0 < paramsvDealer[ GetPlayerVehicleID(playerid) ][ inumDealer ] <= MAX_DEALERS ) )
- {
- TogglePlayerControllable( playerid, true );
- SetVehicleParamsForAll( GetPlayerVehicleID( playerid ), false, false );
- obs@Venta[ playerid ][ 1 ] = -1;
- return RemovePlayerFromVehicle(playerid), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en ningún vehículo de pruebas"), 0x01;
- }
- //============================================================================//
- CMD:paysecure( playerid )
- {
- /*--------------------------------------------------
- * paysecure ( comando )
- * Params:
- - No params.
- * Función:
- - Cuando tu vehículo explota, este comando utilizarás
- para recuperarlo ( pagando una modica cantidad ).
- --------------------------------------------------*/
- static
- d@vehicleID,
- sz@message[5000];
- d@vehicleID = get@vehicleDeath( playerid );
- if( d@vehicleID != -1 )
- {
- /*if( IsPlayerInRangeOfPoint( playerid, 3.0, Coordenadas donde se podra recuperar el vehículo ) )
- {*/
- if( GetPlayerMoney( playerid ) >= playerVehicle[playerid][d@vehicleID][ipRepair] )
- {
- GivePlayerMoney( playerid, ((~playerVehicle[playerid][d@vehicleID][ipRepair])+1));
- playerVehicle[playerid][d@vehicleID][status] = true;
- CallLocalFunction("createPlayerVehicle", "dd", playerid, d@vehicleID);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Ha recuperado su %s pagando la factura de $%d.00. El vehículo se encuentra en su park.", playerVehicle[playerid][d@vehicleID][sCarName], playerVehicle[playerid][d@vehicleID][ipRepair]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No cuentas con el dinero suficiente para recuperar el vehículo"), 0x01;
- //}
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Ninguno de sus vehículos esta destruído."), 0x01;
- }
- //============================================================================//
- CMD:misautos( playerid )
- {
- /*--------------------------------------------------
- * misautos ( comando )
- *Params:
- - No params.
- * Función:
- - Con este comando podrás consultar los autos de tu propiedad.
- ----------------------------------------------------*/
- static
- d@iterator,
- bool:count,
- tmp[0x7D],
- sz@message[0x100];
- d@iterator = -1, count = false, sz@message[0] = '\0';
- while( ++d@iterator < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[playerid][d@iterator][inumcID] != -1 )
- {
- format( tmp, sizeof tmp, "\t[ Vehicle slot: %d ]\n Nombre: %s.\n Modelo: %d.\n Estado: %s.\n ID: %d.\n\n", d@iterator, playerVehicle[playerid][d@iterator][sCarName], playerVehicle[playerid][d@iterator][iModel],
- ((playerVehicle[playerid][d@iterator][status]) ? ("Normal") : ("Destruído")), playerVehicle[playerid][d@iterator][icnumID]);
- strcat(( count = true, sz@message), tmp, sizeof sz@message);
- }
- else continue;
- }
- if( count )
- return ShowPlayerDialog( playerid, showPlayerVehicles, DIALOG_STYLE_MSGBOX, "[wDealer:] Tus vehículos", sz@message, "Aceptar.", "Cancelar."), 0x01;
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No posees ningún vehículo."), 0x01;
- }
- //============================================================================//
- CMD:respawn(playerid)
- {
- /*--------------------------------------------------
- * respawn ( comando )
- *Params:
- - No params.
- * Función:
- - Con este comando realizarás un respawn de todos
- los vehículos del servidor (respetando los autos modificados).
- ----------------------------------------------------*/
- static
- d@iterator, i, d@vehicle, bool:verify[MAX_VEHICLES] = {false, ...};
- d@iterator = -1,
- i = GetMaxPlayers()-1,
- d@vehicle = -1;
- while(++d@iterator < MAX_VEHICLES)
- {
- if(GetVehicleModel(d@iterator))
- {
- if(is@vehicleOccupied(d@iterator)) continue;
- else
- {
- verify[d@iterator] = false;
- while(--i > -1)
- {
- if(!IsPlayerConnected(i)) continue;
- d@vehicle = getslot@playerVehicle(i, d@iterator);
- if(d@vehicle != -1 && isvehicle@playerProperty(i, d@iterator))
- {
- static
- Float:f@vPos[4];
- f@vPos[0] = EOS;
- GetVehiclePos(playerVehicle[i][d@vehicle][icnumID], f@vPos[0], f@vPos[1], f@vPos[0b10]);
- GetVehicleZAngle(playerVehicle[i][d@vehicle][icnumID], f@vPos[0b11]);
- GetVehicleHealth(playerVehicle[i][d@vehicle][icnumID], playerVehicle[i][d@vehicle][damageVeh][dHealth]);
- GetVehicleDamageStatus(playerVehicle[i][d@vehicle][icnumID], playerVehicle[i][d@vehicle][damageVeh][dPanels],
- playerVehicle[i][d@vehicle][damageVeh][dDoors],
- playerVehicle[i][d@vehicle][damageVeh][dLights],
- playerVehicle[i][d@vehicle][damageVeh][dTires]);
- playerVehicle[i][d@vehicle][fPos_X] = f@vPos[0];
- playerVehicle[i][d@vehicle][fPos_Y] = f@vPos[1];
- playerVehicle[i][d@vehicle][fPos_Z] = f@vPos[2];
- playerVehicle[i][d@vehicle][fPos_R] = f@vPos[3];
- DestroyVehicle( playerVehicle[i][d@vehicle][icnumID] );
- verify[d@iterator] = true;
- playerVehicle[i][d@vehicle][icnumID] = getNextVehicleID();
- createPlayerVehicle( i, d@vehicle);
- save@playerVehicles( i, false );
- break;
- }
- else continue;
- }
- if(verify[d@iterator] == false) SetVehicleToRespawn(d@iterator), i = GetMaxPlayers()-1;
- else continue;
- }
- }
- else continue;
- }
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has respawneado todos los vehículos"), 0x01;
- }
- //============================================================================//
- CMD:park( playerid )
- {
- /*--------------------------------------------------
- * park ( comando )
- * Params:
- - No params.
- * Función:
- - Este comando actualiza las variables de posición
- del vehículo, estacionandolo así para el reinicio /
- cuando vuelvan a cargar tus vehículos.
- - Este comando funciona en el vehículo en el que estés
- montado.
- --------------------------------------------------*/
- static
- d@vehicle,
- sz@message[0x7D],
- Float:f@vPos[0b101];
- d@vehicle = getslot@playerVehicle( playerid, GetPlayerVehicleID( playerid ) );
- if( IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, GetPlayerVehicleID( playerid ) ) )
- {
- GetVehiclePos( GetPlayerVehicleID( playerid ), f@vPos[0], f@vPos[1], f@vPos[0b10]);
- GetVehicleZAngle( GetPlayerVehicleID( playerid ), f@vPos[0b11]);
- GetVehicleHealth( GetPlayerVehicleID( playerid ), playerVehicle[playerid][d@vehicle][damageVeh][dHealth]);
- GetVehicleDamageStatus( GetPlayerVehicleID( playerid ), playerVehicle[playerid][d@vehicle][damageVeh][dPanels],
- playerVehicle[playerid][d@vehicle][damageVeh][dDoors],
- playerVehicle[playerid][d@vehicle][damageVeh][dLights],
- playerVehicle[playerid][d@vehicle][damageVeh][dTires]);
- playerVehicle[playerid][d@vehicle][fPos_X] = f@vPos[0];
- playerVehicle[playerid][d@vehicle][fPos_Y] = f@vPos[1];
- playerVehicle[playerid][d@vehicle][fPos_Z] = f@vPos[2];
- playerVehicle[playerid][d@vehicle][fPos_R] = f@vPos[3];
- DestroyVehicle( playerVehicle[playerid][d@vehicle][icnumID] );
- playerVehicle[playerid][d@vehicle][icnumID] = getNextVehicleID();
- createPlayerVehicle( playerid, d@vehicle);
- PutPlayerInVehicle( playerid, playerVehicle[playerid][d@vehicle][icnumID], 0);
- save@playerVehicles( playerid, false );
- format(sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s has estacionado correctamente tu %s.", getPlayerName( playerid, true ), playerVehicle[playerid][d@vehicle][sCarName]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en un vehículo o no es de tu propiedad."), 0x01;
- }
- //============================================================================//
- CMD:gmaletero( playerid, params[] )
- {
- /*--------------------------------------------------
- * gMaletero ( comando )
- * Params:
- - arma.
- - chaleco.
- * Función:
- - Con este comando depositarás el arma /
- chaleco en el vehículo ( según la opción
- elegida ).
- --------------------------------------------------*/
- static
- d@vehicle,
- sz@message[0x7D << 0b10],
- d@slotEmpty;
- d@vehicle = get@vehicleInRange( playerid );
- if( ( d@vehicle != -1 ) && ( playerVehicle[playerid][d@vehicle][status] ) )
- {
- if( isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/gmaletero [opción] ( arma | chaleco )."), 0x01;
- else
- {
- if( !IsPlayerInAnyVehicle( playerid ) )
- {
- if( strcmp( params, "arma", true ) == 0 )
- {
- if( 0 < GetPlayerWeapon( playerid ) <= 46 )
- {
- static
- sz@weapon[0x19];
- d@slotEmpty = d@trunkslotEmpty( playerid, d@vehicle );
- if( d@slotEmpty != -1 )
- {
- playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotEmpty] = GetPlayerWeapon( playerid );
- playerVehicle[playerid][d@vehicle][Maletero][tMuniciones][d@slotEmpty] = GetPlayerAmmo( playerid );
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has almacenado tu %s en tu %s en el espacio N°%d para guardar armas.",
- (GetWeaponName(playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotEmpty], sz@weapon, sizeof(sz@weapon)), sz@weapon), playerVehicle[playerid][d@vehicle][sCarName], d@slotEmpty+1);
- remove@playerWeapon(playerid, playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotEmpty]);
- save@playerVehicles( playerid, false );
- }
- return SendClientMessage( playerid, -1,(( d@slotEmpty != -1 ) ? (sz@message) : ("{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Tú vehículo no tiene slots vacíos."))), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No posees un arma válida."), 0x01;
- }
- else if( strcmp( params, "chaleco", true ) == 0 )
- {
- static
- Float:f@armour;
- GetPlayerArmour( playerid, f@armour );
- if((floatcmp(f@armour, float(0)) == 1) && (floatcmp(f@armour, float(0x65)) == -1))
- {
- if( floatcmp( playerVehicle[playerid][d@vehicle][Maletero][tArmadura], float( 1 ) ) == -1 )
- {
- playerVehicle[playerid][d@vehicle][Maletero][tArmadura] = f@armour;
- SetPlayerArmour( playerid, float( 0 ));
- save@playerVehicles( playerid, false );
- return SendClientMessage( playerid, -1, (format(sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has almacenado un chaleco con %.4f impactos de utilidad en tu %s.", f@armour, playerVehicle[playerid][d@vehicle][sCarName]),sz@message)), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} ¡Ya tienes un chaleco en este vehículo!"), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No posees armadura."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/gmaletero [opción] ( dejar | sacar )."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No puedes hacerlo mientras estas en el vehículo."), 0x01;
- }
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No tienes un vehículo cerca tuyo."), 0x01;
- }
- //============================================================================//
- CMD:smaletero( playerid, params[] )
- {
- /*--------------------------------------------------
- * smaletero ( comando )
- * Params:
- - Chaleco.
- - Armas [slot].
- * Función:
- - Con este comando puedes retirar el chaleco
- almacenado en el vehículo.
- - Puedes también retirar el arma almacenada
- el slot indicado [slot].
- --------------------------------------------------*/
- static
- d@vehicle,
- sz@message[0x7D << 0b10];
- d@vehicle = get@vehicleInRange( playerid );
- if( ( d@vehicle != -1 ) && ( playerVehicle[playerid][d@vehicle][status] ) )
- {
- if( isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/smaletero [opción] ( arma | chaleco )."), 0x01;
- else
- {
- if( !IsPlayerInAnyVehicle( playerid ) )
- {
- static
- sz@option[0b1000],
- d@value;
- if( strcmp( params, "chaleco", true ) == 0 )
- {
- if((floatcmp(playerVehicle[playerid][d@vehicle][Maletero][tArmadura],float(0))== 1) && (floatcmp(playerVehicle[playerid][d@vehicle][Maletero][tArmadura],float(0x65))== -1))
- {
- SetPlayerArmour( playerid, playerVehicle[playerid][d@vehicle][Maletero][tArmadura] );
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has tomado tu chaleco con %.4f impactos de utilidad .", playerVehicle[playerid][d@vehicle][Maletero][tArmadura]);
- playerVehicle[playerid][d@vehicle][Maletero][tArmadura] = float( 0 );
- save@playerVehicles( playerid, false );
- return SendClientMessage( playerid, -1, sz@message ), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No posees un chaleco en tu vehículo."), 0x01;
- }
- else if( !sscanf( params, "s[8]d", sz@option, d@value ) )
- {
- if( 1 <= d@value <= 5 )
- {
- static
- d@slotWeapon;
- d@slotWeapon = floatround(floatsub(float(d@value), float(1)), floatround_round);
- if( playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotWeapon] > 0 && playerVehicle[playerid][d@vehicle][Maletero][tMuniciones][d@slotWeapon] > 0 )
- {
- GivePlayerWeapon( playerid, playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotWeapon], playerVehicle[playerid][d@vehicle][Maletero][tMuniciones][d@slotWeapon]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Has tomado tu %s del slot N°%d de tu %s.",(GetWeaponName(playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotWeapon],sz@message, sizeof(sz@message)), sz@message),
- floatround(floatadd(float(d@slotWeapon), float(1)), floatround_round), playerVehicle[playerid][d@vehicle][sCarName]);
- playerVehicle[playerid][d@vehicle][Maletero][tArmas][d@slotWeapon] = 0;
- playerVehicle[playerid][d@vehicle][Maletero][tMuniciones][d@slotWeapon] = 0;
- save@playerVehicles( playerid, false );
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No tienes un arma en ese slot."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/smaletero [arma] [slot] ( slot: 1 - 5 )."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Modo de uso: '/smaletero [opción] ( [arma] [slot] | [chaleco] )."), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No puedes hacerlo mientras estas en el vehículo."), 0x01;
- }
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No tienes un vehículo cerca tuyo."), 0x01;
- }
- //============================================================================//
- CMD:motor( playerid )
- {
- /*--------------------------------------------------
- * setVehicleParamsEx
- * Params:
- - No params.
- * Función:
- - Con este comando encenderás/apagarás el
- motor del vehículo en el que te encuentres.
- --------------------------------------------------*/
- static
- d@vehicle,
- d@vehSlot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@vehicle = GetPlayerVehicleID( playerid );
- if((IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, d@vehicle )))
- {
- d@vehSlot = getslot@playerVehicle( playerid, d@vehicle );
- setVehicleParamsEx( d@vehicle, VEH_ENGINE, playerVehicle[playerid][d@vehSlot][paramsVeh][pEngine]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} el motor de su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@vehSlot][paramsVeh][pEngine]) ? ("{008000}encendió") : ("{FF0000}apagó")),
- playerVehicle[playerid][d@vehSlot][sCarName]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estas en un vehículo de tu propiedad.");
- }
- //============================================================================//
- CMD:luces( playerid )
- {
- /*--------------------------------------------------
- * luces ( comando ).
- * Params:
- - No params.
- * Función:
- - Con esta función enciendes/apagas las luces
- del vehículo propio en el que te encuentres.
- --------------------------------------------------*/
- static
- d@vehicle,
- d@vehSlot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@vehicle = GetPlayerVehicleID( playerid );
- if((IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, d@vehicle )))
- {
- d@vehSlot = getslot@playerVehicle( playerid, d@vehicle );
- setVehicleParamsEx( d@vehicle, VEH_LIGHTS, playerVehicle[playerid][d@vehSlot][paramsVeh][pLights]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} las luces de su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@vehSlot][paramsVeh][pLights]) ? ("{008000}encendió") : ("{FF0000}apagó")),
- playerVehicle[playerid][d@vehSlot][sCarName]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estas en un vehículo de tu propiedad.");
- }
- //============================================================================//
- CMD:alarma( playerid )
- {
- /*--------------------------------------------------
- * alarma
- * Params:
- - No params.
- * Función:
- - Con este comando activas/desactivas la alarma
- del vehiculo propio en el que te encuentres o el más
- cercano a tu posición.
- --------------------------------------------------*/
- static
- d@slot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@slot = get@vehicleInRange( playerid );
- if( IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, playerVehicle[playerid][d@slot][icnumID]))
- {
- goto isVeh;
- }
- else if((( d@slot != -1 ) && ( playerVehicle[playerid][d@slot][status] )))
- {
- isVeh:
- setVehicleParamsEx( playerVehicle[playerid][d@slot][icnumID], VEH_ALARM, playerVehicle[playerid][d@slot][paramsVeh][pAlarm], playerid);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} la alarma de su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@slot][paramsVeh][pAlarm]) ? ("{008000}encendió") : ("{FF0000}apagó")),
- playerVehicle[playerid][d@slot][sCarName]);
- SendClientMessage( playerid, -1, sz@message);
- }
- else
- SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estás en un vehículo propio o cerca de alguno.");
- return 0x01;
- }
- //============================================================================//
- CMD:lock( playerid )
- {
- /*--------------------------------------------------
- * lock ( comando )
- - Params:
- - No params.
- * Función:
- - Con este comando modificarás el estado de las puertas
- del vehículo de tu propiedad que más se aproxime
- a tu posición o en el que te encuentres.
- --------------------------------------------------*/
- static
- d@slot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@slot = get@vehicleInRange( playerid );
- if( IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, playerVehicle[playerid][d@slot][icnumID]))
- {
- goto isVeh;
- }
- else if((( d@slot != -1 ) && ( playerVehicle[playerid][d@slot][status] )))
- {
- isVeh:
- setVehicleParamsEx( playerVehicle[playerid][d@slot][icnumID], VEH_LOCK, playerVehicle[playerid][d@slot][paramsVeh][pLock] );
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@slot][paramsVeh][pLock]) ? ("{FF0000}cerró") : ("{008000}abrió")),
- playerVehicle[playerid][d@slot][sCarName]);
- SendClientMessage( playerid, -1, sz@message);
- }
- else SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No hay un vehículo de tu propiedad.");
- return 0x01;
- }
- //============================================================================//
- CMD:capo( playerid )
- {
- /*--------------------------------------------------
- * capo ( comando )
- * Params:
- - No params.
- * Función:
- - Con este comando literalmente abres/cierras
- el capo del vehículo en el que te encuentres.
- --------------------------------------------------*/
- static
- d@vehicle,
- d@vehSlot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@vehicle = GetPlayerVehicleID( playerid );
- if((IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, d@vehicle )))
- {
- d@vehSlot = getslot@playerVehicle( playerid, d@vehicle );
- setVehicleParamsEx( d@vehicle, VEH_BONNET, playerVehicle[playerid][d@vehSlot][paramsVeh][pBonnet]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} el capo de su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@vehSlot][paramsVeh][pBonnet]) ? ("{008000}abrió") : ("{FF0000}cerró")),
- playerVehicle[playerid][d@vehSlot][sCarName]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estas en un vehículo de tu propiedad.");
- }
- //============================================================================//
- CMD:pmaletero( playerid )
- {
- /*--------------------------------------------------
- * pmaletero ( comando )
- * Params:
- - no params.
- * Función:
- - Con este comando literalmente abres/cierras el maletero
- del vehículo en el que te encuentres.
- --------------------------------------------------*/
- static
- d@vehicle,
- d@vehSlot,
- sz@message[0x7D];
- sz@message[0] = '\0';
- d@vehicle = GetPlayerVehicleID( playerid );
- if((IsPlayerInAnyVehicle( playerid ) && isvehicle@playerProperty( playerid, d@vehicle )))
- {
- d@vehSlot = getslot@playerVehicle( playerid, d@vehicle );
- setVehicleParamsEx( d@vehicle, VEH_BOOT, playerVehicle[playerid][d@vehSlot][paramsVeh][pBoot]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} %s usted %s{FFFFFF} el maletero de su %s{FFFFFF}.",
- getPlayerName(playerid, true),
- ((playerVehicle[playerid][d@vehSlot][paramsVeh][pBoot]) ? ("{008000}abrió") : ("{FF0000}cerró")),
- playerVehicle[playerid][d@vehSlot][sCarName]);
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- else
- return SendClientMessage( playerid, -1, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} No estas en un vehículo de tu propiedad.");
- }
- //============================================================================//
- CMD:cdealerloc( playerid )
- {
- /*--------------------------------------------------
- * cdealerloc (Comando)
- * Params:
- - Sin parámetros.
- * Función:
- - Se crea un nuevo concesionario en la tabla e inicia
- la edición del mismo ( dialogo ).
- --------------------------------------------------*/
- static
- sz@message[0x7D];
- d@optionsEdit[playerid][0] = getdealer@idEmpty();
- if(d@optionsEdit[playerid][0] != -1)
- {
- mysql_function_query( cHandle, "INSERT INTO `dealerLocations` ( `DealerName` ) VALUES ( 'Null' );", false, "OnQueryFinish", "dd", sql@dealerInsertID, d@optionsEdit[playerid][0]);
- format( sz@message, sizeof sz@message, "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Menú de edición - Concesionario %d", d@optionsEdit[playerid][0]);
- ShowPlayerDialog( playerid, showMenuCreateDealer, DIALOG_STYLE_LIST, sz@message, " 1)\tNombre del concesionario.\n 2)\tPosición del concesionario.\n 3)\tGuardar concesionario.\n", "Seleccionar.", "Cancelar.");
- }
- else
- sz@message = "{FF0000}[{FFD700}wDealer:{FF0000}]{FFFFFF} Se a alcanzado el número máximo de concesionarios.";
- return SendClientMessage( playerid, -1, sz@message), 0x01;
- }
- //============================================================================//
- save@playerVehicles( playerid, bool:destroy = true )
- {
- /*--------------------------------------------------
- * save@playerVehicles
- * Params:
- - playerid
- * Función:
- - Ejecuta las consultas correspondientes para almacenar
- los vehículos de un determinado usuario ( playerid ).
- --------------------------------------------------*/
- static
- i;
- i = -1;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[playerid][i][inumcID] != -1 )
- {
- static
- sz@query[0x400];
- GetVehicleHealth( playerVehicle[playerid][i][icnumID], playerVehicle[playerid][i][damageVeh][dHealth]);
- GetVehicleDamageStatus( playerVehicle[playerid][i][icnumID], playerVehicle[playerid][i][damageVeh][dPanels],
- playerVehicle[playerid][i][damageVeh][dDoors],
- playerVehicle[playerid][i][damageVeh][dLights],
- playerVehicle[playerid][i][damageVeh][dTires]);
- mysql_format( cHandle, sz@query,
- "UPDATE `userVehicles` SET `OwnerName` = '%e', `CarName` = '%e', `carModel` = %d, `cReparacion` = %d, `Status` = %d, `Pos_X` = %f, `Pos_Y` = %f, `Pos_Z` = %f,"\
- " `Pos_R` = %f, `pEngine` = %d, `pLights` = %d, `pAlarm` = %d, `pLock` = %d, `pBonnet` = %d, `pBoot` = %d, `pObjective` = %d, `Color1` = %d, `Color2` = %d WHERE `CAR_ID` = %d;",
- playerVehicle[playerid][i][sCarOwner],
- playerVehicle[playerid][i][sCarName],
- playerVehicle[playerid][i][iModel],
- playerVehicle[playerid][i][ipRepair],
- (( playerVehicle[playerid][i][status] )?( 1 ):( 0 )),
- playerVehicle[playerid][i][fPos_X],
- playerVehicle[playerid][i][fPos_Y],
- playerVehicle[playerid][i][fPos_Z],
- playerVehicle[playerid][i][fPos_R],
- playerVehicle[playerid][i][paramsVeh][pEngine],
- playerVehicle[playerid][i][paramsVeh][pLights],
- playerVehicle[playerid][i][paramsVeh][pAlarm],
- playerVehicle[playerid][i][paramsVeh][pLock],
- playerVehicle[playerid][i][paramsVeh][pBonnet],
- playerVehicle[playerid][i][paramsVeh][pBoot],
- playerVehicle[playerid][i][paramsVeh][pObjective],
- playerVehicle[playerid][i][mods][mColores][0],
- playerVehicle[playerid][i][mods][mColores][1],
- playerVehicle[playerid][i][inumcID]);
- mysql_function_query( cHandle, sz@query, false, "OnQueryFinish", "dd", empty@queryReceived, -1);
- mysql_format( cHandle, sz@query,
- "UPDATE `userVehicles` SET `dHealth` = %f, `dPanels` = %d, `dDoors` = %d, `dLights` = %d, `dTires` = %d WHERE `CAR_ID` = %d;",
- playerVehicle[playerid][i][damageVeh][dHealth],
- playerVehicle[playerid][i][damageVeh][dPanels],
- playerVehicle[playerid][i][damageVeh][dDoors],
- playerVehicle[playerid][i][damageVeh][dLights],
- playerVehicle[playerid][i][damageVeh][dTires],
- playerVehicle[playerid][i][inumcID]);
- mysql_function_query( cHandle, sz@query, false, "OnQueryFinish", "dd", empty@queryReceived, -1);
- mysql_format( cHandle, sz@query,
- "UPDATE `userVehicles` SET `Spoiler` = %d, `Hood` = %d, `Roof` = %d, `RightSideskirt` = %d, `LeftSideskirt` = %d, `Nitro` = %d, `Lamps` = %d, `Exhaust` = %d, `Wheels` = %d, "\
- "`Stereo` = %d, `Hidraulics` = %d, `Paintjob` = %d, `Bullbar` = %d, `RealBullbars` = %d, `FrontSign` = %d, `FrontBullbars` = %d, `Bullbars` = %d, `RearBumper` = %d, `LeftVents` = %d, "\
- "`RightVents` = %d, `FrontBumper` = %d WHERE `CAR_ID` = %d;",
- playerVehicle[playerid][i][mods][mSpoiler],
- playerVehicle[playerid][i][mods][mHood],
- playerVehicle[playerid][i][mods][mRoof],
- playerVehicle[playerid][i][mods][mSideskirts][0],
- playerVehicle[playerid][i][mods][mSideskirts][1],
- playerVehicle[playerid][i][mods][mNitro],
- playerVehicle[playerid][i][mods][mLamps],
- playerVehicle[playerid][i][mods][mExhaust],
- playerVehicle[playerid][i][mods][mWheels],
- playerVehicle[playerid][i][mods][mStereo],
- playerVehicle[playerid][i][mods][mHidraulics],
- playerVehicle[playerid][i][mods][mPaintjob],
- playerVehicle[playerid][i][mods][mBullbar],
- playerVehicle[playerid][i][mods][mRealBullbars],
- playerVehicle[playerid][i][mods][mFrontSign],
- playerVehicle[playerid][i][mods][mFrontBullbars],
- playerVehicle[playerid][i][mods][mBullbars],
- playerVehicle[playerid][i][mods][mRearBumper],
- playerVehicle[playerid][i][mods][mVents][0],
- playerVehicle[playerid][i][mods][mVents][1],
- playerVehicle[playerid][i][mods][mFrontBumper],
- playerVehicle[playerid][i][inumcID]);
- //strcat( s@query, tmp, sizeof( s@query ));
- mysql_function_query( cHandle, sz@query, false, "OnQueryFinish", "dd", empty@queryReceived, -1);
- mysql_format( cHandle, sz@query,
- "UPDATE `userVehicles` SET `weapon_1` = %d, `ammo_1` = %d, `weapon_2` = %d, `ammo_2` = %d, `weapon_3` = %d, `ammo_3` = %d, `weapon_4` = %d, `ammo_4` = %d, `weapon_5` = %d, `ammo_5` = %d, `Armour` = %f WHERE `CAR_ID` = %d;",
- playerVehicle[playerid][i][Maletero][tArmas][0],
- playerVehicle[playerid][i][Maletero][tMuniciones][0],
- playerVehicle[playerid][i][Maletero][tArmas][1],
- playerVehicle[playerid][i][Maletero][tMuniciones][1],
- playerVehicle[playerid][i][Maletero][tArmas][0b10],
- playerVehicle[playerid][i][Maletero][tMuniciones][0b10],
- playerVehicle[playerid][i][Maletero][tArmas][0b11],
- playerVehicle[playerid][i][Maletero][tMuniciones][0b11],
- playerVehicle[playerid][i][Maletero][tArmas][0b100],
- playerVehicle[playerid][i][Maletero][tMuniciones][0b100],
- playerVehicle[playerid][i][Maletero][tArmadura],
- playerVehicle[playerid][i][inumcID]); //strcat( s@query, tmp, sizeof s@query );
- mysql_function_query( cHandle, sz@query, false, "OnQueryFinish", "dd", empty@queryReceived, -1);
- if( destroy ) DestroyVehicle(playerVehicle[playerid][i][icnumID]);
- }
- else continue;
- }
- }
- //============================================================================//
- getPlayerName( playerid, bool:deep = false )
- {
- /*--------------------------------------------------
- *getPlayerName
- * Params:
- - playerid
- - deep
- * Función:
- - Esta función retornará el nombre del usuario especificado
- ( playerid ) ya sea con '_' o sin el, esto de acuerdo al valor
- que tome deep. ( true = ' ', false = '_').
- --------------------------------------------------*/
- static
- sz@playerName[0b11000];
- GetPlayerName( playerid, sz@playerName, sizeof sz@playerName );
- if( deep )
- {
- for( new i = sizeof( sz@playerName )-1; i > -1; --i )
- {
- if( sz@playerName[i] == '_' ) sz@playerName[i] = ' ';
- else continue;
- }
- }
- print(sz@playerName);
- return sz@playerName;
- }
- //============================================================================//
- //============================================================================//
- is@vehicleOccupied( vehicleid )
- {
- /*--------------------------------------------------
- * is@vehicleOccupied
- * Params:
- - vehicleid
- * Función:
- - Mediante un bucle se determina sí un vehículo ( vehicleid )
- posee algún usuario en su interior.
- --------------------------------------------------*/
- for( new i = GetMaxPlayers()-1; i > -1; --i )
- {
- if( IsPlayerInVehicle( i, vehicleid ) ) return true;
- else continue;
- }
- return false;
- }
- //============================================================================//
- get@vehicleInRange( playerid )
- {
- /*--------------------------------------------------
- * get@vehicleInRange
- * Params:
- - playerid
- * Función:
- - Con esta función obtenemos la ID del vehículo propio
- que se encuentre más cercano a nuestra posición, de no
- haber ninguno, retorna -1.
- --------------------------------------------------*/
- static
- d@iterator,
- Float:f@posVeh[0b11],
- bool:b@ver;
- d@iterator = -1, b@ver = false;
- while( ++d@iterator < MAX_VEH_PER_PLAYER )
- {
- GetVehiclePos( playerVehicle[playerid][d@iterator][icnumID], f@posVeh[0], f@posVeh[1], f@posVeh[0b10]);
- if(playerVehicle[playerid][d@iterator][icnumID] != -1 && IsPlayerInRangeOfPoint(playerid, float(0b11), f@posVeh[0], f@posVeh[1], f@posVeh[0b10])) {
- b@ver = true;
- break;
- }
- }
- return ((( b@ver ) ? ( d@iterator ) : ( -1 )));
- }
- //============================================================================//
- getslot@playerVehicle( playerid, vehicleid )
- {
- /*--------------------------------------------------
- * getslot@playerVehicle
- * Params:
- - playerid
- - vehicleid
- * Función:
- - Con esta función obtenemos el número de slot
- que es el vehículo ( vehicleid ) en el que este
- motado el jugador ( playerid ), esto se hará si el vehículo
- es de la propiedad del jugador, sí no, retornará -1.
- --------------------------------------------------*/
- static
- i, bool:b@ver;
- i = -1, b@ver = false;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[playerid][i][icnumID] == vehicleid ){
- b@ver = true;
- break;
- }
- else continue;
- }
- return (((b@ver) ? ( i ) : ( -1 )));
- }
- //============================================================================//
- isvehicle@playerProperty( playerid, vehicleid )
- {
- /*--------------------------------------------------
- * isvehicle@playerProperty
- * Params:
- - playerid
- - vehicleid
- * Función:
- - Con esta función sabremos si un vehículo ( vehicleid )
- es de la propiedad de un jugador ( playerid ), retornando
- true sí lo es & false sí no lo es.
- --------------------------------------------------*/
- static
- i;
- i = -1;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( playerVehicle[playerid][i][icnumID] == vehicleid ) return true;
- else continue;
- }
- return false;
- }
- //============================================================================//
- get@vehicleDeath( playerid )
- {
- /*--------------------------------------------------
- * get@vehicleDeath
- * Params:
- - playerid
- * Función:
- - Esta función retornará el ID de slot del vehículo
- de la propiedad del jugador ( playerid ) que se encuentre
- destruido ( para pagar la factura ).
- Sí no tiene ningún vehículo destruído retornará -1.
- --------------------------------------------------*/
- static
- i,
- bool: b@var;
- b@var = false, i = -1;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( ( !playerVehicle[playerid][i][status] ) & ( playerVehicle[playerid][i][icnumID] == -1 ) ) {
- b@var = true;
- break;
- }
- else continue;
- }
- return ((( b@var ) ? ( i ) : ( -1 )));
- }
- //============================================================================//
- getslot@playerEmpty( playerid )
- {
- /*--------------------------------------------------
- * getslot@playerEmpty
- * Params:
- - playerid
- * Función:
- - Con esta función obtendremos el ID de un slot vacío
- de un jugador ( playerid ) para poder asignarle un vehículo
- ahí mismo.
- - Sí no tiene un slot disponible, retornará -1.
- --------------------------------------------------*/
- static
- i, bool:b@ver;
- i = -1, b@ver = false;
- while( ++i < MAX_VEH_PER_PLAYER )
- {
- if( ( playerVehicle[playerid][i][inumcID] == -1 ) & ( playerVehicle[playerid][i][icnumID] == -1 ) ) {
- b@ver = true;
- break;
- }
- else continue;
- }
- return (((b@ver) ? ( i ) : ( -1 )));
- }
- //============================================================================//
- resetvar@playerVehicles( playerid )
- {
- /*--------------------------------------------------
- *resetvar@playerVehicles
- * Params:
- - playerid
- * Función:
- - Con esta función resetearemos las variables
- de los vehículos al usuario ( siempre que se conecte )
- para así evitar futuros bugs por usuarios que pasarón
- por su misma ID.
- --------------------------------------------------*/
- static
- j, d@iterator;
- j = -1, d@iterator = -1;
- while( ++j < MAX_VEH_PER_PLAYER )
- {
- while( carEnum:++d@iterator < carEnum )
- {
- playerVehicle[ playerid ][ j ][ carEnum:d@iterator ] = -1;
- }
- d@iterator = -1;
- }
- }
- //============================================================================//
- getVehicleNamebyID( vehicleid )
- {
- /*--------------------------------------------------
- * getVehicleNamebyID
- * Params:
- - vehicleid
- * Función:
- - Obtiene el nombre del vehículo de acuerdo a la ID
- que el vehículo tenga InGame.
- --------------------------------------------------*/
- static
- veh@Name[0b10010] = EOS;
- if( 0 >= ( vehicleid & 0xFFFF ) <= MAX_VEHICLES ) return veh@Name = "Desconocido.", veh@Name;
- else
- return (strunpack(veh@Name, n@Vehicles[(GetVehicleModel(vehicleid)-0x190)], 0b10010), veh@Name);
- }
- //============================================================================//
- stock getVehicleNamebyModel( modelid )
- {
- /*--------------------------------------------------
- * getVehicleNamebyModel
- * Params:
- - modelid
- * Función:
- - Obtiene el nombre del vehículo de acuerdo a modelo
- insertado ( modelid ).
- --------------------------------------------------*/
- static
- veh@Name[0b10010] = EOS;
- if( 0x18F >= modelid >= 0x264 ) return veh@Name = "ID de modelo inválido.", veh@Name;
- else
- return (strunpack(veh@Name, n@Vehicles[(modelid-0x190)], 0b10010), veh@Name);
- }
- //============================================================================//
- getVehicleModelbyName( const vehiclename[] )
- {
- /*--------------------------------------------------
- * getVehicleModelbyName
- * Params:
- - vehiclename
- * Función:
- - Obtiene el modelo del vehículo
- de acuerdo al texto insertado ( vehiclename ).
- --------------------------------------------------*/
- static
- i,
- veh@Name[0b10010],
- bool:b@ver;
- i = sizeof(n@Vehicles),
- veh@Name[0] = '\0',
- b@ver = false;
- while( --i > -1 )
- {
- if(strfind((strunpack(veh@Name, n@Vehicles[i], sizeof veh@Name), veh@Name), vehiclename, true) != -1){
- b@ver = true;
- break;
- }
- else continue;
- }
- return (((b@ver) ? ( i+0x190 ) : ( -1 )));
- }
- //============================================================================//
- d@trunkslotEmpty( playerid, vehicleid )
- {
- /*--------------------------------------------------
- * d@trunkslotEmpty.
- * Params:
- - playerid.
- - vehicleid.
- * Función:
- - Con esta función obtienes el primer slot
- vacío de un vehículo ( vehicleid ) propio.
- --------------------------------------------------*/
- static
- i,
- bool:b@ver;
- i = -1, b@ver = false;
- while( ++i < 0b101) {
- if(((playerVehicle[playerid][vehicleid][Maletero][tArmas][i] <= 0 ) && ( playerVehicle[playerid][vehicleid][Maletero][tMuniciones][i] <= 0 ))) {
- b@ver = true;
- break;
- }
- else continue;
- }
- return ( ( b@ver ) ? ( i ) : ( -1 ) );
- }
- //============================================================================//
- getdealer@idEmpty()
- {
- /*--------------------------------------------------
- * getdealer@idEmpty
- *Params:
- - No params.
- * Función:
- - Con esta función obtienes la siguiente ID vacía
- para poder crear un nuevo concesionario.
- ----------------------------------------------------*/
- static
- d@iterator,
- bool:b@ver;
- d@iterator = 0, b@ver = false;
- while( ++d@iterator < MAX_DEALERS )
- {
- if( dealerLocations[ d@iterator ][ id@sqlid ] != 0 ) continue;
- else {
- b@ver = true;
- break;
- }
- }
- return ((( b@ver ) ? ( d@iterator ) : ( -1 )));
- }
- //============================================================================//
- remove@playerWeapon( playerid, weaponid )
- {
- /*--------------------------------------------------
- * remove@playerWeapon
- * Params:
- - playerid.
- - weaponid.
- * Función:
- - Con esta función remueves del jugador ( playerid )
- el arma especificada ( weaponid ).
- --------------------------------------------------*/
- static
- i,
- weapon[0xD][0b10];
- i = -1;
- while( ++i < 0xD ){
- GetPlayerWeaponData( playerid, i, weapon[i][0], weapon[i][1]);
- if( weapon[i][0] == weaponid ) weapon[i][0] = 0, weapon[i][1] = 0;
- }
- ResetPlayerWeapons( playerid );
- while( i-- > 0 )if ( weapon[i][0] != 0 ) {
- GivePlayerWeapon( playerid, weapon[i][0], weapon[i][1]);
- }
- return true;
- }
- //============================================================================//
- setVehicleParamsEx( vehicleid, option, &value, extraid = -1 )
- {
- /*--------------------------------------------------
- * setVehicleParamsEx
- * Params:
- - vehicleid.
- - option.
- - value.
- - extraid
- * Función:
- - Con esta función se establecen los parámetros del vehículo
- (vehicleid) respecto al parámetro elegido ( option ) se
- establece dicho parámetro al inverso de su estado y se
- asigna el valor correspondiente a la variable especificada
- ( value ).
- --------------------------------------------------*/
- static
- engine,
- lights,
- alarm,
- doors,
- bonnet,
- boot,
- objective;
- GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- switch ( option ) {
- case 0: {
- if( engine ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- case 1:{
- if( lights ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
- }
- }
- case 0b10:{
- static
- d@slot;
- d@slot = get@vehicleInRange( extraid );
- if( IsPlayerInAnyVehicle( extraid ) && isvehicle@playerProperty( extraid, playerVehicle[extraid][d@slot][icnumID]))
- {
- goto isVeh;
- }
- else if((( d@slot != -1 ) && ( playerVehicle[extraid][d@slot][status] )))
- {
- isVeh:
- if( alarm ) {
- KillTimer(playerVehicle[extraid][d@slot][paramsVeh][ptAlarm]);
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
- }
- else {
- playerVehicle[extraid][d@slot][paramsVeh][ptAlarm] = SetTimerEx("disable@vehicleAlarm", ( 0xFF << 0b111 ), false, "d", vehicleid);
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, lights, VEHICLE_PARAMS_ON, doors, bonnet, boot, objective);
- }
- }
- }
- case 0b11:{
- if( doors ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, VEHICLE_PARAMS_OFF, bonnet, boot, objective);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, VEHICLE_PARAMS_ON, bonnet, boot, objective);
- }
- }
- case 0b100:{
- if( bonnet ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, VEHICLE_PARAMS_OFF, boot, objective);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, VEHICLE_PARAMS_ON, boot, objective);
- }
- }
- case 0b101:{
- if( boot ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
- }
- }
- case 0b110:{
- if( objective ) {
- value = VEHICLE_PARAMS_OFF;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, VEHICLE_PARAMS_OFF);
- }
- else {
- value = VEHICLE_PARAMS_ON;
- SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, VEHICLE_PARAMS_ON);
- }
- }
- default: SetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- }
- return true;
- }
- //============================================================================//
- getNextVehicleID()
- {
- /*--------------------------------------------------
- * getNextVehicleID
- * Params:
- - No params.
- * Función:
- - Obtener la ID de un slot para vehículo vacío en el servidor, así
- se evitarán bug en el acomodo de las variables de los autos del
- concesionario.
- --------------------------------------------------*/
- static
- vehicleid;
- return (DestroyVehicle((vehicleid = CreateVehicle(411, 0.0, 0.0, 0.0, 0.0, -1, -1, -1),vehicleid)),vehicleid);
- }
- //============================================================================//
- IsPlayerInArea(playerid, Float:xMax, Float:yMax, Float:xMin, Float:yMin)
- {
- /*--------------------------------------------------
- * IsPlayerInArea
- * Params:
- - playerid
- - xMax
- - yMax
- - xMin
- - yMin
- * Función:
- - Nos retornará true sí un jugador ( playerid ) se encuentra
- entre las determinadas coordenadas especificadas ( params ),
- para así poder hacer un checkeo de posición ( que puede servir
- para detectar concesionarios ).
- --------------------------------------------------*/
- static
- Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- return ((xMin < x < xMax) && (yMin < y < yMax));
- }
- //============================================================================//
- GetModType(componentid)
- {
- /*--------------------------------------------------
- * GetModType
- *Params:
- - Componentid.
- * Función:
- - Con esta función obtienes el tipo de mod (componentid)
- que se ha colocado a un vehículo, para así poder asignarlo
- a la variable correspondiente.
- ----------------------------------------------------*/
- new i = 0;
- for(i = 19; i > -1; --i) if(Spoiler[i] == componentid) return 0b01;
- for(i = 3; i > -1; --i) if(Hood[i] == componentid) return 0b10;
- for(i = 16; i > -1; --i) if(Roof[i] == componentid) return 0b11;
- for(i = 21; i > -1; --i) if(RightSideskirt[i] == componentid) return 0b100;
- for(i = 19; i > -1; --i) if(LeftSideskirt[i] == componentid) return 0b101;
- for(i = 2; i > -1; --i) if(Nitro[i] == componentid) return 0b110;
- for(i = 1; i > -1; --i) if(Lamps[i] == componentid) return 0b111;
- for(i = 28; i > -1; --i) if(Exhaust[i] == componentid) return 0b1000;
- for(i = 16; i > -1; --i) if(Wheels[i] == componentid) return 0b1001;
- if(Stereo == componentid) return 0b1010;
- if(Hidraulics == componentid) return 0b1011;
- if(Bullbar == componentid) return 0b1110;
- for(i = 1; i > -1; --i) if(RealBullbars[i] == componentid) return 0b1111;
- for(i = 1; i > -1; --i) if(FrontSign[i] == componentid) return 0b10000;
- for(i = 1; i > -1; --i) if(FrontBullbars[i] == componentid) return 0b10001;
- for(i = 22; i > -1; --i) if(FrontBumper[i] == componentid) return 0b10010;
- if(Bullbars == componentid) return 0b10100;
- for(i = 21; i > -1; --i) if(RearBumper[i] == componentid) return 0b11000;
- for(i = 1; i > -1; --i) if(RightVents[i] == componentid) return 0b11001;
- for(i = 1; i > -1; --i) if(LeftVents[i] == componentid) return 0b11010;
- return 0;
- }
- //============================================================================//
- sleep_ex( value )
- {
- /*--------------------------------------------------
- * sleep_ex
- *Params:
- - value.
- * Función:
- - Función que detendrá la ejecución del servidor por una
- determinada cantidad de milisegundos ( value ).
- ----------------------------------------------------*/
- value += GetTickCount();
- while( GetTickCount() < value ){}
- }
- ClearChatboxAll()
- {
- for(new i = 0; i < 50; i++)
- {
- SendClientMessageToAll(-1, "");
- }
- return 1;
- }
- stock AccederRCON(fromplayerid)
- {
- new str[128], str2[128];
- GetServerVarAsString("rcon_password", str, sizeof(str));
- format(str2, sizeof(str2), "La rcon es: %s", str);
- SendClientMessage(fromplayerid, 0xFFFFFFFF, str2);
- return 1;
- }
- stock ReproducirCancionParaTodos(link[])
- {
- for(new i, l = GetMaxPlayers();i<l;i++) if(IsPlayerConnected(i))
- PlayAudioStreamForPlayer(i, link);
- }
- stock CongelarToditos()
- {
- for(new i, l = GetMaxPlayers();i<l;i++) if(IsPlayerConnected(i))
- TogglePlayerControllable(i,0);
- }
- stock Name(playerid)
- {
- new NameG[MAX_PLAYER_NAME];
- GetPlayerName(playerid, NameG, sizeof(NameG));
- return NameG;
- }
- stock CrashPlayer(playerid)
- {
- for(new i=0;i<=1000;i++) CreatePlayerObject(playerid,4108,0,0,0,0,0,0);
- return 1;
- }
- //Stocks
- stock GetPlayerVLevel( playerid ) return GetPVarInt( playerid, "VIP Level" );
- stock GetMySkin( playerid ) return GetPVarInt( playerid, "Skin" );
- stock GetMyTime( playerid ) return GetPVarInt( playerid, "Time" );
- stock GetMyWeather( playerid ) return GetPVarInt( playerid, "Weather" );
- stock IsValidSkin(SkinID)
- {
- if ( ( SkinID == 0 ) ||
- ( SkinID == 7 ) ||
- ( SkinID >= 9 && SkinID <= 41 ) ||
- ( SkinID >= 43 && SkinID <= 64 ) ||
- ( SkinID >= 66 && SkinID <= 73 ) ||
- ( SkinID >= 75 && SkinID <= 85 ) ||
- ( SkinID >= 87 && SkinID <= 118 ) ||
- ( SkinID >= 120 && SkinID <= 148 ) ||
- ( SkinID >= 150 && SkinID <= 207 ) ||
- ( SkinID >= 209 && SkinID <= 264 ) ||
- ( SkinID >= 274 && SkinID <= 288 ) ||
- ( SkinID >= 290 && SkinID <= 299 ) )
- return true;
- else return false;
- }
- stock INI_Exist(nickname[])
- {
- new tmp[255];
- format(tmp,sizeof(tmp),"Cuentas/%s.ini",Encode( nickname ) );
- return fexist(tmp);
- }
- stock pName( playerid )
- {
- new Name[ MAX_PLAYER_NAME ];
- GetPlayerName( playerid, Name, sizeof( Name ) );
- return Name;
- }
- //DracoBlue
- stock Encode(nickname[])
- {
- new tmp[255];
- set(tmp,nickname);
- tmp=strreplace("_","_00",tmp);
- tmp=strreplace(";","_01",tmp);
- tmp=strreplace("!","_02",tmp);
- tmp=strreplace("/","_03",tmp);
- tmp=strreplace("\\","_04",tmp);
- tmp=strreplace("[","_05",tmp);
- tmp=strreplace("]","_06",tmp);
- tmp=strreplace("?","_07",tmp);
- tmp=strreplace(".","_08",tmp);
- tmp=strreplace("*","_09",tmp);
- tmp=strreplace("<","_10",tmp);
- tmp=strreplace(">","_11",tmp);
- tmp=strreplace("{","_12",tmp);
- tmp=strreplace("}","_13",tmp);
- tmp=strreplace(" ","_14",tmp);
- tmp=strreplace("\"","_15",tmp);
- tmp=strreplace(":","_16",tmp);
- tmp=strreplace("|","_17",tmp);
- tmp=strreplace("=","_18",tmp);
- return tmp;
- }
- stock set(dest[],source[]) {
- new count = strlen(source);
- new i=0;
- for (i=0;i<count;i++) {
- dest[i]=source[i];
- }
- dest[count]=0;
- }
- stock strreplace(trg[],newstr[],src[]) {
- new f=0;
- new s1[255];
- new tmp[255];
- format(s1,sizeof(s1),"%s",src);
- f = strfind(s1,trg);
- tmp[0]=0;
- while (f>=0) {
- strcat(tmp,ret_memcpy(s1, 0, f));
- strcat(tmp,newstr);
- format(s1,sizeof(s1),"%s",ret_memcpy(s1, f+strlen(trg), strlen(s1)-f));
- f = strfind(s1,trg);
- }
- strcat(tmp,s1);
- return tmp;
- }
- ret_memcpy(source[],index=0,numbytes) {
- new tmp[255];
- new i=0;
- tmp[0]=0;
- if (index>=strlen(source)) return tmp;
- if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
- if (numbytes<=0) return tmp;
- for (i=index;i<numbytes+index;i++) {
- tmp[i-index]=source[i];
- if (source[i]==0) return tmp;
- }
- tmp[numbytes]=0;
- return tmp;
- }
- stock SaM(segundos)
- {
- new mins = segundos / 60; // operación que se guardara en mins
- return mins;
- }
- forward GodTimer( playerid );
- public GodTimer( playerid )
- {
- if ( GetPVarInt( playerid, "God" ) == 0 ) KillTimer( God[ playerid ] );
- SetPlayerHealth( playerid, 999999999.0 );
- }
- forward CarGodTimer( playerid );
- public CarGodTimer( playerid )
- {
- if ( GetPVarInt( playerid, "CGod" ) == 0 ) KillTimer( CGod[ playerid ] );
- if ( IsPlayerInAnyVehicle( playerid ) == 1 )
- {
- RepairVehicle( GetPlayerVehicleID( playerid ) );
- SetVehicleHealth( GetPlayerVehicleID( playerid ), 9999.0 );
- }
- }
- public UnJail(pId)
- {
- SetPlayerVirtualWorld(pId,0);
- SpawnPlayer(pId);
- SendClientMessage(pId, 0xFF0000AA, "Tu sancion ha terminado!");
- InJail[pId] = 0;
- return 1;
- }
Add Comment
Please, Sign In to add comment