21.08.2012, 00:30
Sorry, this will works
PHP код:
new vehcheid[MAX_PLAYERS], vehspawned[MAX_PLAYERS]; // as global variable
// OnPlayerConnect
vehspawned[playerid] = 0;
// OnPlayerCommandText
if(strcmp(cmdtext, "/elegy", true) == 0)
{
new Float: X, Float: Y, Float: Z, Float: A;
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are driving a vehicle.");
if(vehspawned[playerid] == 1)
{
DestroyVehicle(vehcheid[playerid]);
vehspawned[playerid] = 0;
}
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
vehcheid[playerid] = CreateVehicle(562, X, Y, Z, A, 0, 0, 0);
vehspawned[playerid] = 1;
PutPlayerInVehicle(playerid, vehcheid[playerid], 0);
return 1;
}