1) автору в срочном порядке изучит как правильно оформлять код.
2) куча ошибокДобавлено (30.05.2009, 14:00)
---------------------------------------------
[pwn]#include <a_samp>
//____________________________[ОПЦИИ]________________________________________
#define STANDARTDISTANTION 50 //стандартная дистанция до взрыва
#define SPEED 150 //таймер милисекунды
#define ONLYRCON 0 //только для админов !
//______________________________________________________________________________
new OBJEKT[MAX_VEHICLES];
new Long[MAX_VEHICLES] = STANDARTDISTANTION,Build[MAX_VEHICLES] = 0;
new bool:GUNMODE[MAX_VEHICLES];
public OnFilterScriptInit()
{
print("=======================================");
print("[FS]Car Gun by MYSAN (LOADED)");
print("Translated by [TMP]oDyBaH");
print("=======================================");
return 1;
}
public OnFilterScriptExit()
{
for(new c;c<MAX_VEHICLES;c++)
{
if(GUNMODE[c] == true)DestroyObject(OBJEKT[c]);
}
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
DestroyObject(OBJEKT[vehicleid]);
Build[vehicleid] = 0;
GUNMODE[vehicleid] = false;
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerState(playerid) == 2 && GUNMODE[GetPlayerVehicleID(playerid)] == true)
{
new K, U, L,Float:x, Float:y, Float:z, Float:a;
GetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid),a);
if(Build[GetPlayerVehicleID(playerid)] == 1)
{
OBJEKT[GetPlayerVehicleID(playerid)] = CreateObject(360,x,y,z+1.2,0.0,0.0,a+90.0);
Long[GetPlayerVehicleID(playerid)] = STANDARTDISTANTION;
Build[GetPlayerVehicleID(playerid)] = 0;
}
if(Build[GetPlayerVehicleID(playerid)] == 2)
{
DestroyObject(OBJEKT[GetPlayerVehicleID(playerid)]);
Build[GetPlayerVehicleID(playerid)] = 0;
GUNMODE[GetPlayerVehicleID(playerid)] = false;
return 1;
}
SetObjectPos(OBJEKT[GetPlayerVehicleID(playerid)],x,y,z+1.2);
SetObjectRot(OBJEKT[GetPlayerVehicleID(playerid)],0.0,0.0,a+90.0);
GetPlayerKeys(playerid,K,U,L);
if(K == KEY_ANALOG_RIGHT)
{
Long[GetPlayerVehicleID(playerid)] += 15;
}
if(K == KEY_ANALOG_LEFT)
{
Long[GetPlayerVehicleID(playerid)] = STANDARTDISTANTION;
}
if(K == KEY_FIRE)
{
x += (Long[GetPlayerVehicleID(playerid)] * floatsin(-a, degrees));
y += (Long[GetPlayerVehicleID(playerid)] * floatcos(-a, degrees));
CreateExplosion(x, y, z, 10, 5.0);
}
}
return 1;
}
stock IsCarForGun(id)
{
new GunCar[] = {
400, 401, 405,
409, 410, 411, 412,
415, 419, 421, 422,
426, 429, 439, 442,
451, 458, 466, 467,
470, 475, 477, 478,
479, 480, 491, 492,
494, 496, 502, 503,
504, 506, 516, 517,
518, 526, 527, 529,
531, 533, 534, 535,
536, 539, 540, 541,
542, 543, 545, 546,
547, 549, 550, 551,
555, 558, 559, 560,
561, 562, 565, 566,
571, 572, 575, 576,
579, 580, 583, 585,
587, 589, 596, 597,
598, 599, 601, 602
};
for(new veh = 0; veh < sizeof(GunCar); veh++)
{
if(GetVehicleModel(id) == GunCar[veh])return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/gunon", cmdtext, true, 6) == 0)
{
if(ONLYRCON && !IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000AA," Ты не админ !");
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) != 2)return SendClientMessage(playerid,0xFF0000AA," Ты не в машине или ты не водитель!");
if(!IsCarForGun(GetPlayerVehicleID(playerid)))return SendClientMessage(playerid,0xFF0000AA," На этой машине нельзя!");
if(GUNMODE[GetPlayerVehicleID(playerid)] == true)return SendClientMessage(playerid,0xFF0000AA," На машине уже есть оружие!");
GUNMODE[GetPlayerVehicleID(playerid)] = true;
Build[GetPlayerVehicleID(playerid)] = 1;
SendClientMessage(playerid,0x5BC476FF," Оружие установлено на ваш автомобиль!");
return 1;
}
if (strcmp("/gunoff", cmdtext, true, 7) == 0)
{
if(ONLYRCON && !IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000AA," Ты не админ !");
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) != 2)return SendClientMessage(playerid,0xFF0000AA," Ты не в машине или ты не водитель !");
if(GUNMODE[GetPlayerVehicleID(playerid)] == false)return SendClientMessage(playerid,0xFF0000AA," На машине нет оружия!");
Build[GetPlayerVehicleID(playerid)] = 2;
SendClientMessage(playerid,0xFF0000AA," Оружие удалено с вашего автомобиля !");
return 1;
}
return 0;
}[/pwn]исправил ошибки и кое что переделал.
Примитивно но ржачно