new PlayerCar[playerid]; // /v command with ZCMD and sscanf: COMMAND:v(playerid, params[]) { new carid, color1, color2; if(sscanf(params,"ddd", carid, color1, color2))return SendClientMessage(playerid, GREY, "USAGE: /v [carid] [color1] [color2]"); if(carid < 400 || carid > 611) return SendClientMessage(playerid, GREY, "Cars IDs can't be below 400 or above 611!"); else { if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, GREY, "Color number can't be below 0 or above 160!"); if(color2 < 0 || color2 > 126) return SendClientMessage(playerid, GREY, "Color number can't be below 0 or above 160!"); new Float: X,Float: Y,Float: Z; GetPlayerPos(playerid, X,Y,Z); CreateVehicle(carid, X,Y,Z, 0.0, color1, color2, 60000); PutPlayerInVehicle(playerid, carid, 0); PlayerCar[playerid] = carid; } return 1; } // To despawn the vehicle when the player leaves it public OnPlayerExitVehicle(playerid, vehicleid) { if(PlayerCar[playerid] == vehicleid) { DestroyVehicle(PlayerCar[playerid]); return 1; } return 1; }
C:\Users\dragonlady\Desktop\B-Man\Downloads\B-Man's Freeroam (0.3d)\pawno\include\sscanf2.inc(27) : error 021: symbol already defined: "sscanf" C:\Users\dragonlady\Desktop\B-Man\Downloads\B-Man's Freeroam (0.3d)\pawno\include\sscanf2.inc(28 ) : error 021: symbol already defined: "unformat" C:\Users\dragonlady\Desktop\B-Man\Downloads\B-Man's Freeroam (0.3d) - Copy\filterscripts\vehicle.pwn(79) : error 017: undefined symbol "playerid" C:\Users\dragonlady\Desktop\B-Man\Downloads\B-Man's Freeroam (0.3d) - Copy\filterscripts\vehicle.pwn(79) : error 009: invalid array size (negative, zero or out of bounds) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
you have problems with your sscanf, download the last version, and you put playerid meabe in gamemodeinit o filerscriptinit, but let mee see that lines.
|
#include <a_samp> #include <zcmd> #include <sscanf2> //============================================================================== // // Defines // //============================================================================== /* NOTE: Just use true/false! */ /* Boring defines */ #define USE_ADMIN false // if true, you need to be admin to do this #define PAY_CMD false // if true, you need to pay an amount of cash to use this command #define USE_RMESSAGE false // if true, it automaticly sends messages to everyone #define PAY 1000 // the amount you need to pay to use a command /* The random messages, change them if you dont like it */ #define MESSAGE1 "This server uses VehicleSpawner from Wesley221 (/spawnhelp)" #define MESSAGE2 "/spawnhelp for all the commands of this filterscript! (/spawnhelp)" #define MESSAGE3 "Spawning something only costs $%i! (/spawnhelp)" #define MESSAGE4 "/(v/w) [vehicle/weaponname] to spawn a vehicle/weapon! No ID's needed! (/spawnhelp)" #define MESSAGE5 "Out of ideas! Change this line to anything you like! (/spawnhelp)" /* Colours */ #define C_RED 0xFF0000FF #define C_GREEN 0x00FF00FF //============================================================================== // // Vehicle and weapon names // //============================================================================== new aVehicleNames[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"} }; new aWeaponNames[47][] = { {"Unarmed"},{"Brass Knuckles"},{"Golf Club"},{"Nite Stick"},{"Knife"},{"Baseball Bat"},{"Shovel"},{"Pool Cue"},{"Katana"},{"Chainsaw"},{"Purple Dildo"}, {"Smal White Vibrator"},{"Large White Vibrator"},{"Silver Vibrator"},{"Flowers"},{"Cane"},{"Grenade"},{"Tear Gas"},{"Molotov Cocktail"}, {""},{""},{""}, // Empty spots for ID 19-20-21 (invalid weapon id's) {"9mm"},{"Silenced 9mm"},{"Desert Eagle"},{"Shotgun"},{"Sawn-off Shotgun"},{"Combat Shotgun"},{"Micro SMG"},{"MP5"},{"AK-47"},{"M4"},{"Tec9"}, {"Country Rifle"},{"Sniper Rifle"},{"Rocket Launcher"},{"HS Rocket Launcher"},{"Flamethrower"},{"Minigun"},{"Satchel Charge"},{"Detonator"}, {"Spraycan"},{"Fire Extinguisher"},{"Camera"},{"Nightvision Goggles"},{"Thermal Goggles"},{"Parachute"} }; //============================================================================== // // Commands // //============================================================================== /* Spawn vehicle */ new PlayerCar[playerid]; COMMAND:v(playerid, params[]) { new carid, color1, color2; if(sscanf(params,"ddd", carid, color1, color2))return SendClientMessage(playerid, C_RED, "USAGE: /v [carid] [color1] [color2]"); if(carid < 400 || carid > 611) return SendClientMessage(playerid, C_RED, "Cars IDs can't be below 400 or above 611!"); else { if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, C_RED, "Color number can't be below 0 or above 160!"); if(color2 < 0 || color2 > 126) return SendClientMessage(playerid, C_RED, "Color number can't be below 0 or above 160!"); new Float: X,Float: Y,Float: Z; GetPlayerPos(playerid, X,Y,Z); CreateVehicle(carid, X,Y,Z, 0.0, color1, color2, 60000); PutPlayerInVehicle(playerid, carid, 0); PlayerCar[playerid] = carid; } return 1; } // To despawn the vehicle when the player leaves it public OnPlayerExitVehicle(playerid, vehicleid) { if(PlayerCar[playerid] == vehicleid) { DestroyVehicle(PlayerCar[playerid]); return 1; } return 1; } /* Spawn weapon */ COMMAND:w(playerid, params[]) { #if USE_ADMIN == true if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, C_RED, " ** You need to be an admin (RCON) to use this command! "); #endif new Weapon[50], Ammo; if(!sscanf(params, "s[50]I(500)", Weapon, Ammo)) { new string[128], weapon = GetWeaponID(Weapon); if(weapon < 0 || weapon > 46 || weapon == 19 || weapon == 20 || weapon == 21 || weapon == 22) return SendClientMessage(playerid, C_RED, " ** This is not a valid weapon name! PLease try again"); if(Ammo <= 500 || Ammo > 10000) return SendClientMessage(playerid, C_RED, " ** Minimum ammo: 500 Maximum ammo: 10000 "); GivePlayerWeapon(playerid, weapon, Ammo); #if PAY_CMD == true new moneycheck[128]; if(GetPlayerMoney(playerid) < PAY) return format(moneycheck, sizeof moneycheck, " ** You do not have enough money to buy this weapon! Money required: $%i. Money needed: $%i", PAY, PAY - GetPlayerMoney(playerid)) && SendClientMessage(playerid, C_RED, moneycheck); GivePlayerMoney(playerid, - PAY); format(string, sizeof string, " ** You spawned a %s (Ammo: %i). ID: %i. You paid: $%i", aWeaponNames[weapon], Ammo, weapon, PAY); #else format(string, sizeof string, " ** You spawned a %s (Ammo: %i). ID: %i. ", aWeaponNames[weapon],Ammo, weapon); #endif SendClientMessage(playerid, C_GREEN, string); } else return SendClientMessage(playerid, C_GREEN, " ** Usage: /w(eap)(on) [weaponname] [ammo] "); return 1; } /* Command help */ COMMAND:spawnhelp(playerid, cmdtext[]) { SendClientMessage(playerid, C_GREEN, " -|_|- Vehicle/weapon spawn help -|_|- "); SendClientMessage(playerid, C_RED, " - /v(eh)(icle) [vehiclename] > Spawns a vehicle of your choice "); SendClientMessage(playerid, C_GREEN, " - /w(eap)(on) [weapon name] > Gives you a weapon of your choice "); SendClientMessage(playerid, C_RED, " - /(v/w)names > Gives you a link where to check the weapon/vehicle names "); SendClientMessage(playerid, C_GREEN, " - This filterscript is made by Wesley221! "); return 1; } /* Name help */ COMMAND:vnames(playerid, cmdtext[]) return SendClientMessage(playerid, C_GREEN, " ** Please visit \"https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List\" for all the vehicle names!"); COMMAND:wnames(playerid, cmdtext[]) return SendClientMessage(playerid, C_GREEN, " ** Please visit \"https://sampwiki.blast.hk/wiki/Weapons\" for al the weapon names!"); /* Spawn vehicle & weapon */ COMMAND:veh(playerid, cmdtext[]) return cmd_v(playerid, cmdtext); COMMAND:vehicle(playerid, cmdtext[]) return cmd_v(playerid, cmdtext); COMMAND:weap(playerid, cmdtext[]) return cmd_w(playerid, cmdtext); COMMAND:weapon(playerid, cmdtext[]) return cmd_w(playerid, cmdtext); //============================================================================== // //Stocks // //============================================================================== stock GetVehicleModelID(vehiclename[]) { for(new i = 0; i < 211; i++) { if(strfind(aVehicleNames[i], vehiclename, true) != -1) return i + 400; } return -1; } stock GetWeaponID(weaponname[]) { for(new i = 0; i < 45; i++) { if(strfind(aWeaponNames[i], weaponname, true) != -1) return i; } return -1; } stock GetXYInFrontOfPlayer(playerid, &Float:x2, &Float:y2, Float:distance) { new Float:a; GetPlayerPos(playerid, x2, y2, a); GetPlayerFacingAngle(playerid, a); if(GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); } x2 += (distance * floatsin(-a, degrees)); y2 += (distance * floatcos(-a, degrees)); } //============================================================================== // // Filterscript Init/Exit // //============================================================================== public OnFilterScriptInit(){ print("|_| VehicleSpawner |_|"); print("|_| VehicleSpawner --> Loaded |_|"); print("|_| Do NOT remove the credits |_|"); return 1; } public OnFilterScriptExit(){ print("|_| VehicleSpawner |_|"); print("|_| VehicleSpawner --> UnLoaded |_|"); print("|_| Do NOT remove the credits |_|"); return 1; } //============================================================================== // // Random messages // //============================================================================== #if USE_RMESSAGE == true forward RandomMessage(); public RandomMessage() { new string[128]; format(string, sizeof string, MESSAGE3, PAY); new rand = random(5); if(rand == 0) return rand +1; switch(rand) { case 1: SendClientMessageToAll(C_GREEN, MESSAGE1); case 2: SendClientMessageToAll(C_GREEN, MESSAGE2); case 3: SendClientMessageToAll(C_GREEN, string); case 4: SendClientMessageToAll(C_GREEN, MESSAGE4); case 5: SendClientMessageToAll(C_GREEN, MESSAGE5); } return 1; } public OnPlayerConnect(playerid) { SetTimer("RandomMessage", 60000, true); return 1; } #endif