03.10.2011, 15:11
Hi all. Last time i wanted to make a GUI Vehicles system, and when player created 3'th vehicle the first is deleted automatically. I made that code
I also added test command for see if deleting works:
But when i create 3'th vehicle, the first one don't delete, and when i type /bpu the 3'th is being deleted.
So what i want?
Vehicle spawning system via GUI (with pre-definied list)
Only 2 vehicles at this same time for each player
Can you help me? Thanks
Код:
new count[MAX_SLOTS]; if(listitem == 0) { new Float:X,Float:Y,Float:Z; new Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid); if(count[playerid] == 0) { VehicleSpawned1[playerid] = CreateVehicle(515, X+3,Y,Z, Angle, 1, 1, -1); count[playerid] = 1; LinkVehicleToInterior(VehicleSpawned1[playerid],0); return 1; } if(count[playerid] == 1) { VehicleSpawned2[playerid] = CreateVehicle(515, X+3,Y,Z, Angle, 1, 1, -1); count[playerid] = 2; LinkVehicleToInterior(VehicleSpawned2[playerid],0); return 1; } if(count[playerid] == 2) { DestroyVehicle(VehicleSpawned2[playerid]); DestroyVehicle(VehicleSpawned1[playerid]); count[playerid] = 0; return 1; } PlayerPlaySound(playerid,1085,0,0,0); return 1; }
Код:
if (strcmp("/bpu", cmd, true, 10) == 0) { DestroyVehicle(VehicleSpawned2[playerid]); DestroyVehicle(VehicleSpawned1[playerid]); return 1; }
So what i want?
Vehicle spawning system via GUI (with pre-definied list)
Only 2 vehicles at this same time for each player
Can you help me? Thanks