05.01.2014, 20:40
pawn Код:
#include <a_samp>
new vNRG[MAX_PLAYERS];
stock DestroyPersonalNRG(playerid)
{
if(vNRG[playerid] != 0)
DestroyVehicle(vNRG[playerid]);
vNRG[playerid] = 0;
}
public OnFilterScriptExit()
{
for(new playerid = 0, players = GetMaxPlayers(); playerid < players; playerid ++)
DestroyPersonalNRG(playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyPersonalNRG(playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/pnrg", cmdtext, true, 5) == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else
GetPlayerFacingAngle(playerid, a);
if(vNRG[playerid] != 0)
DestroyVehicle(vNRG[playerid]);
vNRG[playerid] = CreateVehicle(522, x, y, z, a, -1, -1, -1);
LinkVehicleToInterior(vNRG[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, vNRG[playerid], 0);
return 1;
}
return 0;
}