Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <a_mysql>
- #include <zRace>
- #include <foreach>
- static stock g_arrVehicleNames[][] = {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster",
- "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "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 A", "Hotring Racer B", "Bloodring Banger", "Rancher",
- "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt", "Tanker", "Roadtrain",
- "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck",
- "Fortune", "Cadrona", "SWAT Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan",
- "Blade", "Streak", "Freight", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder",
- "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster", "Monster",
- "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30",
- "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "LSPD Car", "SFPD Car", "LVPD Car",
- "Police Rancher", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs",
- "Boxville", "Tiller", "Utility Trailer"
- };
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnPlayerSpawn(playerid)
- {
- for (new i = 0; i != MAX_PLAYER_ATTACHED_OBJECTS; i ++) {
- RemoveAttachedObject(playerid, i);
- }
- SetTimerEx("AddPlayerToys", 3000, false, "i", playerid);
- return 1;
- }
- stock RemoveAttachedObject(playerid, slot)
- {
- if (!IsPlayerConnected(playerid))
- return 0;
- if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
- return 0;
- RemovePlayerAttachedObject(playerid, slot);
- return 1;
- }
- forward AddPlayerToys(playerid); public AddPlayerToys(playerid)
- {
- if(playerid == INVALID_PLAYER_ID)
- return 0;
- if(!IsPlayerConnected(playerid))
- return 0;
- SetPlayerAttachedObject(playerid,9,1310,1,-0.054000,-0.155999,-0.016999,0.000000,89.300018,0.000000,1.000000,1.000000,1.000000);
- return 1;
- }
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("Race Mode");
- SetWorldTime(21);
- SetWeather(10);
- AllowInteriorWeapons(true);
- EnableStuntBonusForAll(true);
- AddPlayerClass(284, 354.7566,-84.7419,1.3355,169.4997, 0, 0, 0, 0, 0, 0);
- CreateVehicle(552, 336.6826, -77.2777, 1.1614, 19.2302, -1, -1, 60000);
- CreateVehicle(552, 318.5034, -77.0695, 1.1998, 92.6342, -1, -1, 60000);
- CreateVehicle(552, 327.6026, -108.5993, 1.1948, 176.2344, -1, -1, 60000);
- CreateVehicle(552, 338.1276, -112.6025, 1.1050, 349.6361, -1, -1, 60000);
- CreateVehicle(400, 320.0182, -87.7260, 2.1224, 89.1613, -1, -1, 60000);
- return 1;
- }
- CMD:createrace(playerid, params[])
- {
- new Float:x,
- Float:y,
- Float:z,
- Float:r,
- id = -1;
- GetPlayerPos(playerid, x,y,z);
- GetPlayerFacingAngle(playerid, r);
- id = CreateRace(x,y,z, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
- if(id != -1)
- {
- SetRaceFacingAngle(id, r);
- SendClientMessageEx(playerid, -1, "Creaste la carrera n-%d", id);
- }
- return 1;
- }
- CMD:carcreate(playerid, params[])
- {
- new carmodel[32];
- if(sscanf(params, "s[32]", carmodel))
- return 1;
- if ((carmodel[0] = GetVehicleModelByName(carmodel)) == 0)
- return SendClientMessage(playerid, -1, "Modelo invalido.");
- static Float:pPos[4];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- GetPlayerFacingAngle(playerid, pPos[3]);
- new id = CreateVehicle(carmodel[0], pPos[0], pPos[1], pPos[2], pPos[3], -1, -1, 0);
- PutPlayerInVehicle(playerid, id, 0);
- return 1;
- }
- CMD:carsave(playerid, params[])
- {
- if(!IsPlayerInAnyVehicle(playerid))
- return 0;
- new id = GetPlayerVehicleID(playerid);
- if(id == INVALID_VEHICLE_ID)
- return 0;
- static Float:pPos[4];
- GetVehiclePos(id, pPos[0], pPos[1], pPos[2]);
- GetVehicleZAngle(id, pPos[3]);
- printf("CreateVehicle(%d, %.4f, %.4f, %.4f, %.4f, -1, -1, 60000);", GetVehicleModel(id), pPos[0], pPos[1], pPos[2], pPos[3]);
- SendClientMessageEx(playerid, -1, "*Vehicle %d saved! (logs)", id);
- return 1;
- }
- public OnPlayerFinishRace(playerid, raceid){
- SendClientMessageEx(playerid, -1, "Finalizado!");
- }
- GetVehicleModelByName(const name[])
- {
- if (IsNumeric(name) && (strval(name) >= 400 && strval(name) <= 611))
- return strval(name);
- for (new i = 0; i < sizeof(g_arrVehicleNames); i ++)
- {
- if (strfind(g_arrVehicleNames[i], name, true) != -1)
- {
- return i + 400;
- }
- }
- return 0;
- }
- IsNumeric(const str[])
- {
- for (new i = 0, l = strlen(str); i != l; i ++)
- {
- if (i == 0 && str[0] == '-')
- continue;
- else if (str[i] < '0' || str[i] > '9')
- return 0;
- }
- return 1;
- }
- CMD:startrace(playerid, params[])
- {
- if(sscanf(params, "d", params[0]))
- return 1;
- if(!RaceExist(params[0]))
- return 0;
- new
- c = TrackCountOfRace(params[0]);
- if(c < 3)
- return SendClientMessage(playerid, -1, "Esa carrera no tiene mas de 3 tracks");
- new
- str[64];
- foreach(new i : Player)
- {
- StartRace(i, params[0]);
- }
- format(str, sizeof(str), "* La carrera %d ha iniciado!", params[0]);
- SendClientMessageToAll(-1, str);
- return 1;
- }
- CMD:editrace(playerid, params[])
- {
- enum ColorsEnum{
- color_id,
- message[34],
- };
- new
- Colors[][ColorsEnum] = {
- {0xC00000FF, "* /editrace [raceid] [type]"}, // red
- {0x66CC00FF} // lime
- }, raceid, type[24], string[128];
- if(sscanf(params, "is[24]S()[128]", raceid, type, string))
- {
- new active = GetActiveRaces();
- SendClientMessage(playerid, Colors[0][color_id], Colors[0][message]);
- if(active > 0)
- SendClientMessageEx(playerid, -1, "Carreras disponibles: %s", StrAvailableRaces());
- SendClientMessage(playerid, -1, "Tipos: StartPos - GO - CreateTrack - SetTrack - ");
- return 1;
- }
- else{
- if (!RaceExist(raceid))
- return 0;
- if (!strcmp(type, "startpos", true)){
- //if (sscanf(string, "d", raceid))
- //return SendClientMessage(playerid, Colors[0][color_id], Colors[0][message]);
- static
- Float:pPos[4];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- GetPlayerFacingAngle(playerid, pPos[3]);
- SetRacePos(raceid, pPos[0], pPos[1], pPos[2]);
- SetRaceFacingAngle(raceid, pPos[3]);
- SetRaceVirtualWorld(raceid, GetPlayerVirtualWorld(playerid));
- SetRaceInterior(raceid, GetPlayerInterior(playerid));
- UpdateRaceDatabaseAll(raceid);
- SendClientMessageEx(playerid, -1,"* Sustituiste la posicion de inicio de la carrera %d,", raceid);
- }
- else if(!strcmp(type, "GO", true))
- {
- static
- Float:pPos[4];
- GetRacePos(raceid, pPos[0], pPos[1], pPos[2]);
- GetRaceFacingAngle(raceid, pPos[3]);
- SetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- SetPlayerFacingAngle(playerid, pPos[3]);
- SetPlayerVirtualWorld(playerid, GetRaceVirtualWorld(raceid));
- SetPlayerInterior(playerid, GetRaceInterior(raceid));
- SendClientMessageEx(playerid, -1,"* Fuiste teleportado a la carrera %d,", raceid);
- }
- else if(!strcmp(type, "createtrack", true))
- {
- static
- Float:pPos[3];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- new id = -1;
- id = CreateTrack(raceid, pPos[0], pPos[1], pPos[2]);
- SendClientMessageEx(playerid, -1,"* Create una track a la race %d. (Track %d)", raceid, id);
- }
- else if(!strcmp(type, "settrack", true))
- {
- new track;
- if (sscanf(string, "d", track))
- return 1;
- if(TrackExist(raceid, track))
- return 0;
- static
- Float:pPos[3];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- SetTrackPos(raceid, track, pPos[0], pPos[1], pPos[2]);
- SendClientMessageEx(playerid, -1,"* Editaste la posicion del track %d (Race %d),", track, raceid);
- }
- }
- return 1;
- }
- stock SendClientMessageEx(playerid, color, const str[], {Float,_}:...)
- {
- static
- args,
- start,
- end,
- string[144]
- ;
- #emit LOAD.S.pri 8
- #emit STOR.pri args
- if (args > 12)
- {
- #emit ADDR.pri str
- #emit STOR.pri start
- for (end = start + (args - 12); end > start; end -= 4)
- {
- #emit LREF.pri end
- #emit PUSH.pri
- }
- #emit PUSH.S str
- #emit PUSH.C 144
- #emit PUSH.C string
- #emit PUSH.C args
- #emit SYSREQ.C format
- SendClientMessage(playerid, color, string);
- #emit LCTRL 5
- #emit SCTRL 4
- #emit RETN
- }
- return SendClientMessage(playerid, color, str);
- }
- CMD:carreras(playerid, params[])
- {
- new count = GetActiveRaces(), string[54];
- format(string, sizeof(string), "%d", count);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement