How can i do this please Help
#1

removed
reason long time ago
Reply
#2

pawn Код:
new vehiclespawned[MAX_PLAYERS] = 0; //at the top of script
new vehis[MAX_PLAYERS];

if (strcmp("/v bansh", cmdtext, true, 10) == 0)
{
    if(vehiclespawned[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already spawned a Vehicle!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a Vehicle");
    new Float:x, Float:y, Float:z, Float:angle; //create the position of the player, which can be anywhere
    GetPlayerPos(playerid, x, y, z); //get the player's position, to know where the car should be put
    GetPlayerFacingAngle(playerid, angle); //get the player's angle, to put the car in the right angle
    vehiclespawned[playerid] = 1;
    new vehis[playerid] = CreateVehicle(429, x, y, z, angle, 0, 0, 60); //in the variable "veh", you're storing and creating a vehicle now!
    //429 is the ID of the car, "0" is the color (black)! change it simply later, I'mma give you a link
    PutPlayerInVehicle(playerid, veh, 0); //this function will put the player into the created vehicle
    ChangeVehicleColor(429, 2, 1); //this will change the vehicle color to black (and white), surely!
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    vehiclespawned[playerid] = 0;
    DestroyVehicle(vehis[playerid]);
    return 1;
}
Reply
#3

Do
pawn Код:
new Veh[MAX_PLAYERS];
above OnPlayerCommandText

Then replace that other one with
pawn Код:
if (strcmp("/v bansh", cmdtext, true, 10) == 0)
{
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a Vehicle");
    if(Veh[playerid] != 0) DestroyVehicle(Veh[playerid]); //Here we destroy their personal vehicle they spawned then continue the rest of the command
    new Float, Float:y, Float:z, Float:angle;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, angle);
    Veh[playerid] = CreateVehicle(429, x, y, z, angle, 0, 0, 60); //We re-create it here
    PutPlayerInVehicle(playerid, Veh[playerid], 0); //put em in it
    ChangeVehicleColor(Veh[playerid], 2, 1); //change the col
    return 1;
}
Reply
#4

removed
Reply
#5

Antonio's method

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    DestroyVehicle(Veh[playerid]);
    return 1;
}
My Method

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    DestroyVehicle(vehis[playerid]);
    return 1;
}
Reply
#6

removed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)