25.07.2014, 02:21
(
Последний раз редактировалось UserName31; 25.07.2014 в 16:35.
)
hey how can i destroy las vehicle i had when i get a new vehicle from a checkpoint?
funtion
checkpoint
enter checkpoint
PHP код:
new LastPlayerInVec[MAX_VEHICLES] = (-1);
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid) == 2) // Is he/she the driver?
LastPlayerInVec[vehicleid] = playerid;
return 1;
}
PHP код:
stock GetLastPlayerInVehicle(vehicleid)
{
if(LastPlayerInVec[vehicleid] != -1) //Did someone entered it?
return LastPlayerInVec[vehicleid];
return 0;
}
PHP код:
if(dialogid == DIALOG_FCARS && response)
{
if(listitem == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(457, x+4,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);//Carid
}
if(listitem == 1)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(545, x+4,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);//carid
}
if(listitem == 2)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(468, x+4,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);//carid
}
if(listitem == 3)
{
ShowPlayerDialog(playerid, DIALOG_FCARS, DIALOG_STYLE_LIST, "Select Free Vehicle", string, "Ok", "");
}
}
PHP код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == Checkpoint[0]) //This checks what checkpoint it is before it continues
{
if(gTeam[playerid] == Team_Civi)
{
new string[200];
format(string, 200, "Caddy\nHustler\nSanchez");
ShowPlayerDialog(playerid, DIALOG_FCARS, DIALOG_STYLE_LIST, "Free Vehicles", string, "Ok", "");
}
if(gTeam[playerid] == Team_Cop || gTeam[playerid] == Team_FBI || gTeam[playerid] == Team_Guard)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
return SendClientMessage(playerid, COLOR_ERROR,"You must be on foot!");
}
new string[200];
format(string, 200, "Police Car (LSPD)\nHPV1000\nFBI Rancher\nEnforcer\nSecuricar");
ShowPlayerDialog(playerid, DIALOG_FCARSL, DIALOG_STYLE_LIST, "Free Vehicles", string, "Ok", "");
}
return 1;
}
if(checkpointid == Checkpoint[3])
{
if(IsCop(playerid)) return SendClientMessage(playerid, COLOR_RED,"You are not A Criminal!");
ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
}
if(checkpointid == Checkpoint[4])
{
ShowPlayerDialog(playerid, WEAPONS, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $1000\nArmour - $2000\n9mm - $2500\nSilence Pistol - $3000\nDesert Eagle - $3500\nShotgun - $5000\nSawn-Off Shotgun - $8000\nCombat Shotgun - $6500\nMicro SMG - $5000\nMP5 - $5500\nTec-9 - $5000\nAK-47 - $10500\nM4 - $10000\nCountry Rifle - $12000\nSniper Rifle - $12000", "Purchase", "Cancel");
}
if(checkpointid == Checkpoint[5])
{
ShowPlayerDialog(playerid, DIALOG_HOSPITAL, DIALOG_STYLE_LIST, "Welcome to Los Santos Medical Center!", "Heal\nCure\nBe a Medic", "Okay", "Cancel");
}
return 1;
}