Vehicle must not respawn -
vassilis - 28.01.2015
Hello guys hello is it possible for players who bought a car when it gets exploded not respawn?
Here is for example when a player gets a car
pawn Код:
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED," SERVER : You don't have so much money!");
GetPlayerPos(playerid, X,Y,Z);
veh = CreateVehicle(499, X,Y,Z, Angle, 44, 44, -1);
PutPlayerInVehicle(playerid,veh,0);
GivePlayerMoney(playerid,-4500);
SendClientMessage(playerid,COLOR_ROYALBLUE,"CAR SHOP : You have bought a Benson Cost: "COL_WHITE" $4,500");
Re: Vehicle must not respawn -
Columbian - 28.01.2015
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED," SERVER : You don't have so much money!");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
veh = AddStaticVehicle(499, X, Y, Z, A, 1, 1);
PutPlayerInVehicle(playerid,veh,0);
GivePlayerMoney(playerid,-4500);
SendClientMessage(playerid,COLOR_ROYALBLUE,"CAR SHOP : You have bought a Benson Cost: "COL_WHITE" $4,500");
Use that and told me how is going
Re: Vehicle must not respawn -
Arxalan - 28.01.2015
Quote:
Originally Posted by Columbian
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED," SERVER : You don't have so much money!");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
veh = AddStaticVehicle(499, X, Y, Z, A, 1, 1);
PutPlayerInVehicle(playerid,veh,0);
GivePlayerMoney(playerid,-4500);
SendClientMessage(playerid,COLOR_ROYALBLUE,"CAR SHOP : You have bought a Benson Cost: "COL_WHITE" $4,500");
Use that and told me how is going
|
He Said that i don't want vehicle to respawn . It need some code in OnVehicleDeath. This code is almost the same code.
Re: Vehicle must not respawn -
andrewgrob - 28.01.2015
use this from my new vehicle script im creating
on top of your script put this
new Float:X,Float:Y,Float:Z,Float:A;
new Car1;
below make a cmd like /hydra
pawn Код:
new vehicleid;
vehicleid= GetPlayerVehicleID(playerid);
DestroyVehicle(vehicleid);
GetPlayerPos(i,X,Y,Z);
GetPlayerFacingAngle(i,A);
Car1 = AddStaticVehicleEx (520,X,Y,Z,A,-1,-1,-1);
PutPlayerInVehicle(playerid,Car1,0);
GameTextForPlayer(playerid,"HYDRA",4000,1);
this checks if a player is in the vehicle and detroys current vehicle and give the player a new vehicle
Car1 = AddStaticVehicleEx (520,X,Y,Z,A,-1,-1,-1); -1 on the end is for the vehicle not to respawn
Re: Vehicle must not respawn -
Lynn - 28.01.2015
pawn Код:
// Top of Script with Global variables.
static
veh[MAX_PLAYERS]; // Asigns the Created vehicle to that player.
pawn Код:
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED," SERVER : You don't have so much money!");
GetPlayerPos(playerid, X,Y,Z);
veh[playerid] = CreateVehicle(499, X,Y,Z, Angle, 44, 44, -1); // This avoids the last CreatedVehicle from being destroyed, it now destroys one assigned to that player.
SetPVarInt(playerid, #CreatedCar, 1);// Player has created a vehicle.
PutPlayerInVehicle(playerid,veh,0);
GivePlayerMoney(playerid,-4500);
SendClientMessage(playerid,COLOR_ROYALBLUE,"CAR SHOP : You have bought a Benson Cost: "COL_WHITE" $4,500");
pawn Код:
public OnVehicleDeath(vehicleid, killerid) // KillerID = Player that caused the vehicle to destroy.
{
if(GetPVarInt(killerid, #CreatedCar) == 1) // Checks if they created a vehicle.
{
DestroyVehicle(veh[playerid]);
DeletePVar(playerid, #CreatedCar); // No longer have a created car assigned to them.
}
return 1;
}
Re: Vehicle must not respawn -
vassilis - 29.01.2015
Quote:
Originally Posted by Lynn
pawn Код:
// Top of Script with Global variables. static veh[MAX_PLAYERS]; // Asigns the Created vehicle to that player.
pawn Код:
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid, COLOR_RED," SERVER : You don't have so much money!"); GetPlayerPos(playerid, X,Y,Z); veh[playerid] = CreateVehicle(499, X,Y,Z, Angle, 44, 44, -1); // This avoids the last CreatedVehicle from being destroyed, it now destroys one assigned to that player. SetPVarInt(playerid, #CreatedCar, 1);// Player has created a vehicle. PutPlayerInVehicle(playerid,veh,0); GivePlayerMoney(playerid,-4500); SendClientMessage(playerid,COLOR_ROYALBLUE,"CAR SHOP : You have bought a Benson Cost: "COL_WHITE" $4,500");
pawn Код:
public OnVehicleDeath(vehicleid, killerid) // KillerID = Player that caused the vehicle to destroy. { if(GetPVarInt(killerid, #CreatedCar) == 1) // Checks if they created a vehicle. { DestroyVehicle(veh[playerid]); DeletePVar(playerid, #CreatedCar); // No longer have a created car assigned to them. } return 1; }
|
I cant use playerid onvehicle death because callback doesnt call it