11.07.2014, 05:58
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]);
}