31.03.2009, 17:43
hi, how do i make it so a player can only have have one vehicle so they cant spam the server, but they can change the vehicle that they have.
thanks
cameron
thanks
cameron
|
Originally Posted by Weirdosport
Create an array, size MAX_PLAYERS.
Make a command that creates a vehicle, and saves the vehicle ID into the array, filed under the players playerid. When they go to use the command, if the vehicleid isn't 0, make it DestroyVehicle(vehicleid), then spawn a new one as before. You can if you wish SetPlayerInVehicle. |
// Top of script
new LastSpawnedCar[MAX_PLAYERS];
// OnPlayerConnect
LastSpawnedCar[playerid] = 0;
// Command
if(LastSpawnedCar[playerid] != 0)
{
DestroyVehicle(LastSpawnedCar[playerid]);
}
LastSpawnedCar[playerid] = CreateVehicle(...,...,...,...,...,...,...);

F:\samp-server\filterscripts\menu.pwn(59) : error 017: undefined symbol "playerid" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Errors.