/* San Andreas Multiplayer 0.2 Debug *** Progress: ** 20/10/2006 Script construction started. ** 21/10/2006 /v || /vehicle [id] command created. Creates a the specified vehicleid. /wsel command created. Stops all to view the world conditions and allows the player to choose the world conditions. JUMP (Time +), SPRINT (Time -), HORN (Weather +), FIRE (Weather -) and ACTION (Select/Exit). Added different spawn locations. Los Santos (Grove Street), San Fierro (Doherty), Las Venturas (Four Dragons). /t || /time [time] command created. Sets the world time to the specified time. /w || /weather [id] command created. Changes the world weather to the specified weather id. ** 22/10/2006 /v || /vehicle [id] now spawns vehicles in the players current interior. /wep [id] [ammo] gives player the specified weapon and ammunition. If no ammo is specified it gives 500 ammo. /bring [id] Brings the specified player id to you and also sets their interior to your current interior. /goto || /warpto [id] Makes the player teleport to the specified player id, it also makes the interior that players current interior. Better formatting for command feedback, they're also coloured according to if the feedback is Good, Bad or Help. /wsel now saves the world conditions when you exit the menu and the time and date it was saved to debug.txt. ** 24/10/2006 /v || /vehicle [id] now spawns vehicles in front of the player using Y_Less' GetPointInFrontOfPlayer. ** 25/10/2006 /bring [id] now places the player brought to you in front of the player who uses the command. /goto || /warpto [id] now places the player who uses the command in front of the player who you're warping to. /vsel command added which allows the player to select vehicles using JUMP (Forward), SPRINT (Back) and ACTION (Select/Exit). ** 28/10/2006 /s || /skin [id] allows you to select the specified ID to be used as a skin. /ssel allows the player to select skins using keys - JUMP (Forward), SPRINT (Back) and ACTION (Select/Exit). ** 29/10/2006 /destroy [id] destroys the selected vehicle id. *** Credits: "Betamaster" for the list of vehicle names. URL - http://forum.sa-mp.com/index.php?topic=139.msg42441#msg42441 "Y_Less" for the GetPointInFrontOfPlayer function. URL - http://forum.sa-mp.com/index.php?topic=638.msg57536#msg57536 "Peter" for his awesome support and help while making this script. URL - http://www.sa-mp.nl SA:MP developer team for the awesome online multiplayer mod for GTA:SA. URL - http://www.sa-mp.com */ #include #include #include #define C_RED 0xFF0000AA #define C_WHITE 0xFFFFFFAA #define C_GREEN 0x00FF00AA #define VEH_DIS 9.0 // World Selection variables new WTIME; new WWEATHER; new WorldSelect[MAX_PLAYERS]; new WorldSel; // Vehicle Selection variables new VehicleSelect[MAX_PLAYERS]; new VSEL = 400; new SVID; new VehSel; // Skin Selection variables new SkinSelect[MAX_PLAYERS]; new SSEL; new SkinSel; // General Variables new VehicleID[256]; 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", //artict1 "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer 2", //artict2 "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", //hotrina "Hotring Racer B", //hotrinb "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", //petro "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", //firela "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster A", //monstera "Monster B", //monsterb "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight Flat", //freiflat "Streak Carriage", //streakc "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer 3", //petrotr "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Freight Carriage", //freibox "Trailer 3", //artict3 "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", //bagboxa "Luggage Trailer B", //bagboxb "Stair Trailer", //tugstair "Boxville", "Farm Plow", //farmtr1 "Utility Trailer" //utiltr1 }; main() { print("\n \201\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\187"); print(" \186 SA:MP Debug Script (2006) \186"); print(" \186 San Andreas Multiplayer \186"); print(" \200\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\205\188\n"); } public OnGameModeInit() { SetGameModeText("Debug Mode 0.2"); ShowPlayerMarkers(1); ShowNameTags(1); EnableTirePopping(1); AddPlayerClass(0,2492.9753,-1667.7841,13.3438,90.0,46,1,24,300,-1,-1); // Los Santos AddPlayerClass(0,-2029.8252,147.9832,28.8359,270.0,46,1,24,300,-1,-1); // San Fierro AddPlayerClass(0,2027.6847,1007.7556,10.8203,270.0,46,1,24,300,-1,-1); // Las Venturas return 1; } public OnPlayerRequestClass(playerid, classid) { switch (classid) { case 0: // Los Santos { SetPlayerPos(playerid,2492.9753,-1667.7841,13.3438); SetPlayerCameraPos(playerid,2495.9753,-1664.7841,13.3438); SetPlayerCameraLookAt(playerid,2492.9753,-1667.7841,14.3438); SetPlayerFacingAngle(playerid,90.0); GameTextForPlayer(playerid,"~r~Los Santos",1500,6); } case 1: // San Fierro { SetPlayerPos(playerid,-2029.8252,147.9832,28.8359); SetPlayerCameraPos(playerid,-2024.8252,152.9832,28.8359); SetPlayerCameraLookAt(playerid,-2029.8252,147.9832,29.8359); SetPlayerFacingAngle(playerid,270.0); GameTextForPlayer(playerid,"~r~San Fierro",1500,6); } case 2: // Las Venturas { SetPlayerPos(playerid,2027.6847,1007.7556,10.8203); SetPlayerCameraPos(playerid,2032.6847,1012.7556,11.8203); SetPlayerCameraLookAt(playerid,2027.6847,1007.7556,10.8203); SetPlayerFacingAngle(playerid,270.0); GameTextForPlayer(playerid,"~r~Las Venturas",1500,6); } } return 1; } public OnGameModeExit() { print("Debug mode closed."); return 1; } public OnPlayerConnect(playerid) { GameTextForPlayer(playerid, "~r~SA:MP ~y~Debug Mode", 3000, 6); return 1; } public OnPlayerDisconnect(playerid) { printf("OnPlayerDisconnect(%d)", playerid); return 1; } public OnPlayerSpawn(playerid) { printf("OnPlayerSpawn(%d)", playerid); AllowPlayerTeleport(playerid, 1); return 1; } public OnPlayerDeath(playerid, killerid, reason) { printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason); SendDeathMessage(killerid,playerid,reason); return 1; } public OnVehicleSpawn(vehicleid) { printf("OnVehicleSpawn(%d)", vehicleid); return 1; } public OnVehicleDeath(vehicleid, killerid) { printf("OnVehicleDeath(%d, %d)", vehicleid, killerid); return 1; } public OnPlayerText(playerid) { printf("OnPlayerText(%d)", playerid); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/g", true)==0 || strcmp(cmd, "/grav", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_WHITE, "USAGE: /g [gravity]"); return 1; } else { new Float:gra = floatstr(tmp); SetGravity(gra); new string[256]; format(string, sizeof(string), "Gravity set to %f", gra); SendClientMessage(playerid, C_GREEN, string); return 1; } return 1; } if(strcmp(cmd, "/destroy", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_WHITE,"USAGE: /destroy [id]"); return 1; } else { new vid = strval(tmp); if(!VehicleID[vid]) { SendClientMessage(playerid, C_RED, "You must enter a valid vehicle ID!"); } else { DestroyVehicle(vid); } } } if(strcmp(cmd, "/v", true)==0 || strcmp(cmd, "/vehicle", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_WHITE, "USAGE: /v [id]"); return 1; } else { new vid = strval(tmp); if(vid <= 611 && vid >= 400) { new Float:x, Float: y, Float:z, Float:a, string[256]; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); new iid = GetPlayerInterior(playerid); GetPointInFrontOfPlayer(playerid, x, y, VEH_DIS); new VID = CreateVehicle(vid, x, y, z, a + 90.0, -1, -1, 6000); LinkVehicleToInterior(VID, iid); format(string, sizeof(string),"VID: %d", VID); SendClientMessage(playerid, C_GREEN, string); VehicleID[VID] = 1; return 1; } else { SendClientMessage(playerid, C_RED, "You must enter a valid vehicle id (400 -> 611)!"); return 1; } } return 1; } if(strcmp(cmd, "/w2", true)==0 || strcmp(cmd, "/weapon", true)==0) { new tmp[256]; new tmp2[256]; tmp = strtok(cmdtext, idx); tmp2 = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_WHITE, "USAGE: /w2 [id] [amount]"); } else { new wid = strval(tmp); new ammo = strval(tmp2); if(wid >= 0 && wid <= 46 && wid != 19 && wid != 20 && wid != 21) { new string[256]; if(!ammo) { GivePlayerWeapon(playerid, wid, 500); format(string, sizeof(string), "WEAPON: ID - %d, Ammo - %d", wid, 500); SendClientMessage(playerid, C_GREEN, string); } else { GivePlayerWeapon(playerid, wid, ammo); format(string, sizeof(string), "WEAPON: ID - %d, Ammo - %d", wid, ammo); SendClientMessage(playerid, C_GREEN, string); } } else { SendClientMessage(playerid, C_RED, "You must enter a valid weapon id (0 -> 46)!"); } return 1; } } if(strcmp(cmd, "/t", true)==0 || strcmp(cmd, "/time", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_RED, "USAGE: /t [time]"); return 1; } else { new tid = strval(tmp); if (tid <= 24 && tid >= 0) { new string[256]; format(string, sizeof(string), "TIME: %d", tid); SendClientMessage(playerid, C_GREEN, string); SetWorldTime(tid); return 1; } else { SendClientMessage(playerid, C_RED, "You must enter a valid weather id (0 -> 24)!"); return 1; } return 1; } } if(strcmp(cmd, "/w", true)==0 || strcmp(cmd, "/weather", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_RED, "USAGE: /w [id]"); } else { new wid = strval(tmp); if (wid <= 45 && wid >= 0) { new string[256]; format(string, sizeof(string), "WEATHER: %d", wid); SendClientMessage(playerid, C_GREEN, string); SetWeather(wid); } else { SendClientMessage(playerid, C_RED, "You must enter a valid weather id (0 -> 45)!"); } } return 1; } if(strcmp(cmd, "/goto", true)==0 || strcmp(cmd, "/warpto", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_RED, "USAGE: /goto [id]"); } else { new pid = strval(tmp); if(pid >= 0 && pid < MAX_PLAYERS && IsPlayerConnected(pid)) { new Float:x, Float:y, Float:z, string[256], iid; GetPointInFrontOfPlayer(pid, x, y, 1.5); GetPlayerName(pid, string, sizeof(string)); iid = GetPlayerInterior(pid); format(string, sizeof(string), "GOTO: %s(%d)", string, pid); SetPlayerInterior(playerid, iid); SetPlayerPos(playerid, x, y, z); SendClientMessage(playerid, C_RED, string); } else { SendClientMessage(playerid, C_RED, "Select an ID that is connected and is valid (0 -> 99)!"); } } return 1; } if(strcmp(cmd, "/bring", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_RED, "USAGE: /bring [id]"); } else { new pid = strval(tmp); if(pid >= 0 && pid < MAX_PLAYERS && IsPlayerConnected(pid)) { new Float:x, Float:y, Float:z, string[256], iid; GetPointInFrontOfPlayer(playerid, x, y, 1.5); GetPlayerName(pid, string, sizeof(string)); iid = GetPlayerInterior(playerid); format(string, sizeof(string), "BRING: %s(%d)", string, pid); SetPlayerInterior(pid, iid); SetPlayerPos(pid, x, y, z); SendClientMessage(playerid, C_RED, string); } else { SendClientMessage(playerid, C_RED, "Select an ID that is connected and is valid (0 -> 99)!"); } } return 1; } if(strcmp(cmd, "/h", true)==0 || strcmp(cmd, "/health", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SetPlayerHealth(playerid, 100.0); SendClientMessage(playerid, C_GREEN, "HEALTH: 100.0"); } else { new Float:hid = floatstr(tmp); new string[256]; format(string, sizeof(string), "HEALTH: %d", hid); SendClientMessage(playerid, C_GREEN, string); SetPlayerHealth(playerid, hid); } return 1; } if(strcmp(cmd, "/vsel", true)==0) { new Float:x, Float:y, Float:z, Float:a; VehicleSelect[playerid] = 1; TogglePlayerControllable(playerid, 0); GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); GetPointInFrontOfPlayer(playerid, x, y, VEH_DIS); SVID = CreateVehicle(VSEL, x, y, z, a + 90.0, -1, -1, 600); GameTextForPlayer(playerid, "~r~Vehicle ~y~Selection", 3000, 6); VehSel = SetTimer("VehicleSelector", 150, 1); return 1; } if(strcmp(cmd, "/wsel", true)==0) { WorldSelect[playerid] = 1; new Float:player_x, Float:player_y, Float:player_z; GetPlayerPos(playerid, player_x, player_y, player_z); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~r~World ~y~Selection", 3000, 6); SetPlayerCameraPos(playerid, player_x + 10.0, player_y + 10.0, player_z + 40.0); SetPlayerCameraLookAt(playerid, player_x + 50.0, player_y + 50.0, player_z + 7.5); WorldSel = SetTimer("WorldSelector", 150, 1); return 1; } if(strcmp(cmd, "/ssel", true)==0) { SkinSelect[playerid] = 1; new Float:x, Float:y, Float:z; GameTextForPlayer(playerid, "~r~Skin ~y~Selection", 3000, 6); GetPlayerPos(playerid, x, y, z); GetPointInFrontOfPlayer(playerid, x, y, 5.0); SetPlayerCameraPos(playerid, x, y, z); GetPlayerPos(playerid, x, y, z); SetPlayerCameraLookAt(playerid, x, y, z); TogglePlayerControllable(playerid, 0); SkinSel = SetTimer("SkinSelector", 150, 1); } if(strcmp(cmd, "/s", true)==0 || strcmp(cmd, "/skin", true)==0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, C_RED, "USAGE: /s [id]"); } else { new sid = strval(tmp); if(sid >= 0 && sid <= 299 && sid != 3 && sid != 4 && sid != 5 && sid != 6 && sid != 8 && sid != 42 && sid != 65 && sid != 74 && sid != 86 && sid != 119 && sid != 149 && sid != 208 && sid != 265 && sid != 266 && sid != 267 && sid != 268 && sid != 269 && sid != 270 && sid != 271 && sid != 272 && sid != 273 && sid != 289) { new string[10]; SetPlayerSkin(playerid, sid); format(string, sizeof(string), "SKIN: %d", sid); SendClientMessage(playerid, C_RED, string); } else { SendClientMessage(playerid, C_RED, "Select a skin that is valid (0 -> 299)!"); } } return 1; } return 0; } public OnPlayerInfoChange(playerid) { printf("OnPlayerInfoChange(%d)"); return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger); return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid); return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate); return 1; } public OnPlayerEnterCheckpoint(playerid) { printf("OnPlayerEnterCheckpoint(%d)", playerid); return 1; } public OnPlayerLeaveCheckpoint(playerid) { printf("OnPlayerLeaveCheckpoint(%d)", playerid); return 1; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public VehicleSelector() { for(new i=0; i