10.07.2014, 18:02
Hello, I'm creating a vehicle spawner and I have few problems. First, I only can spawn one car till the server is online (if I want to spawn another car, I must restart server). Second, my "destroy" command doesn't work and I can't understand why. Third, then spawned vehicle explodes, it respawns where was the first time spawned. And I also got fed warnings, I would appreciate help. Thank you.
There is my code:
And few errors:
There is my code:
Код:
//----- Defines -----// new SpawnedVehicle[MAX_PLAYERS]; //----- Enums -----// enum { DIALOG_VEHICLE }
Код:
//----- Generated Commands -----// CMD:vehicle(playerid, params[]) { if(IsPlayerConnected(playerid)) { if(SpawnedVehicle[playerid] == 0) { ShowPlayerDialog(playerid, DIALOG_VEHICLE, DIALOG_STYLE_INPUT, "Maрinш sistema", " Labukas :P", "Spawn", "Close"); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "Jыs jau turite maрinа."); return 1; } } return 1; } CMD:destroy(playerid, params[]) { if(SpawnedVehicle[playerid] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "Server Error: Tu negali sunaikinti masinos, kurios neturi"); DestroyVehicle(SpawnedVehicle[playerid]); SpawnedVehicle[playerid] = 0; SendClientMessage(playerid, COLOR_YELLOW, "Jus sunaikinote savo masina"); return 1; }
Код:
//----- Generated Publics -----// public LoadPlayer(playerid, name[], value[]) { SpawnedVehicle[playerid] = 0; return 1; }
Код:
//----- Stocks -----// stock SpawnVehicleForPlayer(vehicleid, playerid) { if(SpawnedVehicle[playerid] != 0) { DestroyVehicle(SpawnedVehicle[playerid]); } new Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Angle); SpawnedVehicle[playerid] = CreateVehicle(vehicleid, X, Y, Z+2, Angle, -1, -1, -1); SetVehicleVirtualWorld(SpawnedVehicle[playerid], GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(SpawnedVehicle[playerid], GetPlayerInterior(playerid)); PutPlayerInVehicle(playerid, SpawnedVehicle[playerid = 0]); }
Код:
C:\Users\Magahaka\Documents\samp03z_svr_R1_win32\gamemodes\Gamemode.pwn(136) : warning 235: public function lacks forward declaration (symbol "LoadPlayer") C:\Users\Magahaka\Documents\samp03z_svr_R1_win32\gamemodes\Gamemode.pwn(169) : warning 213: tag mismatch C:\Users\Magahaka\Documents\samp03z_svr_R1_win32\gamemodes\Gamemode.pwn(176) : warning 213: tag mismatch C:\Users\Magahaka\Documents\samp03z_svr_R1_win32\gamemodes\Gamemode.pwn(176) : warning 213: tag mismatch C:\Users\Magahaka\Documents\samp03z_svr_R1_win32\gamemodes\Gamemode.pwn(205) : warning 202: number of arguments does not match definition Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Warnings.