12.01.2014, 00:28
I'll give an example:
As you can see in the pictures, there's a small bug in my script. When a user uses /spawnheli or /spawnplane it comes up with unknown command but it still yields the menu which allows you to spawn the vehicle. In /spawncar, that unknown command error doesn't pop up. Can anyone help me? Here's my code down below:
Dialog 14 is planes, dialog 13 is helicopters. Then here are the commands themselves:
As you can see in the pictures, there's a small bug in my script. When a user uses /spawnheli or /spawnplane it comes up with unknown command but it still yields the menu which allows you to spawn the vehicle. In /spawncar, that unknown command error doesn't pop up. Can anyone help me? Here's my code down below:
Код:
if(dialogid == 14) { if(response) { if(listitem == 0) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(460, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 1) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(476, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 2) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(511, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 3) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(512, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 4) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(513, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 5) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(519, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 6) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(520, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 7) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(553, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 8) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(577, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 9) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(592, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 10) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(593, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } } } if(dialogid == 13) { if(response) { if(listitem == 0) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(417, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 1) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(425, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 2) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(447, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 3) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(469, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 4) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(487, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 5) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(488, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 6) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(497, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 7) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(548, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } if(listitem == 8) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a); new vehicleid = CreateVehicle(563, x+3,y,z, a, -1, -1, -1); PutPlayerInVehicle(playerid, vehicleid, 0); } } }
Код:
CMD:spawnplane(playerid, params[]) { new currentvehicle; currentvehicle = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { DestroyVehicle(currentvehicle); ShowPlayerDialog(playerid,14,DIALOG_STYLE_LIST,""COL_BLUE"Planes:",""COL_ORANGE"Skimmer\n"COL_ORANGE"Rustler\n"COL_ORANGE"Beagle\n"COL_ORANGE"Cropduster\n"COL_ORANGE"Stuntplane\n"COL_ORANGE"Shamal\n"COL_ORANGE"Hydra\n"COL_ORANGE"Nevada\n"COL_ORANGE"AT-400\n"COL_ORANGE"Andromada\n"COL_ORANGE"Dodo\n","Select","Cancel"); } else { ShowPlayerDialog(playerid,14,DIALOG_STYLE_LIST,""COL_BLUE"Planes:",""COL_ORANGE"Skimmer\n"COL_ORANGE"Rustler\n"COL_ORANGE"Beagle\n"COL_ORANGE"Cropduster\n"COL_ORANGE"Stuntplane\n"COL_ORANGE"Shamal\n"COL_ORANGE"Hydra\n"COL_ORANGE"Nevada\n"COL_ORANGE"AT-400\n"COL_ORANGE"Andromada\n"COL_ORANGE"Dodo\n","Select","Cancel"); } } CMD:spawnheli(playerid, params[]) { new currentvehicle; currentvehicle = GetPlayerVehicleID(playerid); if(IsPlayerInAnyVehicle(playerid)) { DestroyVehicle(currentvehicle); ShowPlayerDialog(playerid,13,DIALOG_STYLE_LIST,""COL_BLUE"Helicopters:",""COL_ORANGE"Leviathan\n"COL_ORANGE"Hunter\n"COL_ORANGE"Seasparrow\n"COL_ORANGE"Sparrow\n"COL_ORANGE"Maverick\n"COL_ORANGE"News Maverick\n"COL_ORANGE"Police Maverick\n"COL_ORANGE"Cargobob\n"COL_ORANGE"Raindance\n","Select","Cancel"); } else { ShowPlayerDialog(playerid,13,DIALOG_STYLE_LIST,""COL_BLUE"Helicopters:",""COL_ORANGE"Leviathan\n"COL_ORANGE"Hunter\n"COL_ORANGE"Seasparrow\n"COL_ORANGE"Sparrow\n"COL_ORANGE"Maverick\n"COL_ORANGE"News Maverick\n"COL_ORANGE"Police Maverick\n"COL_ORANGE"Cargobob\n"COL_ORANGE"Raindance\n","Select","Cancel"); } }