[HELP] Vehicle Spawner
#5

Cause you keep setting the variable to 0, and your playerid 0

pawn Код:
CMD:vehicle(playerid, params[])
{
    if(SpawnedVehicle[playerid] == -1)
    {
        ShowPlayerDialog(playerid, DIALOG_VEHICLE, DIALOG_STYLE_INPUT, "Maрinш sistema", " Labukas :P", "Spawn", "Close");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW, "Jыs jau turite maрinа.");
        return 1;
    }
    return 1;
}

CMD:destroy(playerid, params[])
{
    if(SpawnedVehicle[playerid] == -1) return SendClientMessage(playerid, COLOR_YELLOW, "Server Error: Tu negali sunaikinti masinos, kurios neturi");
    DestroyVehicle(SpawnedVehicle[playerid]);
    SpawnedVehicle[playerid] = -1;
    SendClientMessage(playerid, COLOR_YELLOW, "Jus sunaikinote savo masina");
    return 1;
}

forward LoadPlayer(playerid, name[], value[]);
public LoadPlayer(playerid, name[], value[])
{
    SpawnedVehicle[playerid] = -1;
    return 1;
}

stock SpawnVehicleForPlayer(vehicleid, playerid)
{
    if(SpawnedVehicle[playerid] != -1)
    {
        DestroyVehicle(SpawnedVehicle[playerid]);
    }

    new Float:X, Float:Y, Float:Z, Float:Angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    SpawnedVehicle[playerid] = CreateVehicle(vehicleid, X, Y, Z+2, Angle, -1, -1, -1);
    SetVehicleVirtualWorld(SpawnedVehicle[playerid], GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(SpawnedVehicle[playerid], GetPlayerInterior(playerid));
    PutPlayerInVehicle(playerid, SpawnedVehicle[playerid]);
}
Reply


Messages In This Thread
[HELP] Vehicle Spawner - by Povis - 10.07.2014, 18:02
Re: [HELP] Vehicle Spawner - by Povis - 10.07.2014, 22:13
Re: [HELP] Vehicle Spawner - by DavidSparks - 10.07.2014, 22:26
Re: [HELP] Vehicle Spawner - by Povis - 11.07.2014, 05:39
Re: [HELP] Vehicle Spawner - by ABKPot - 11.07.2014, 05:58

Forum Jump:


Users browsing this thread: 1 Guest(s)