new objectid = CreateObject(19419,-0.024999, 0.024999, 0.794999, 0.000000, 0.000000, 0.000000);new vehicleid = GetPlayerVehicleID(playerid);AttachObjectToVehicle(objectid, vehicleid, -0.024999, 0.024999, 0.794999, 0.000000, 0.000000, 0.000000);
http://wiki.sa-mp.com/wiki/DestroyObject
CMD:szirena(playerid){if(pInfo[playerid][pFrakcio] == ALLAMTAG || pInfo[playerid][pFrakcio] == ALLAMFONOK ){if(GetVehicleModel( GetPlayerVehicleID(playerid)) == 507 ){ new objectid = CreateObject(19419,-0.024999, 0.024999, 0.794999, 0.000000, 0.000000, 0.000000); new vehicleid = GetPlayerVehicleID(playerid); AttachObjectToVehicle(objectid, vehicleid, -0.024999, 0.024999, 0.794999, 0.000000, 0.000000, 0.000000); msg(playerid,SZIN_LIGHTBLUE,\"Sziréna felszerelve!\"); cmd_me(playerid, \"felszerel(t) egy szirénát a kocsira.\");}else{ msg(playerid,piros,\"Erre a kocsira nem tehetsz szirénát!\"); msg(playerid,piros,\"CSak Elegantra lehet szirénát feltenni!\");}}else{msg(playerid,piros,\"Te nem az önkormányzatnál dolgozol!\");}return 1;}
new AVO[MAX_VEHICLES]; // Attach Vehicle Objects // tárgy id-k tárolásáraparancs:{new vid = GetPlayerVehicleID(playerid);if(!vid) { return 1; } // nincs jármûbenif(AVO[vid]) { DestroyObject(AVO[vid]); } // ha létre van hozva a tárgy töröljeAVO[vid] = CreateObject(19419,0.0,0.0,0.0,0.0,0.0,0.0); // tárgy létrehozás AttachObjectToVehicle(AVO[vid],vid,-0.024999,0.024999,0.794999,0.0,0.0,0.0); // tárgy csatolásreturn 1;}
persze hogy nem sikerült...nincs is eltárolva a tárgy ID, csak ideiglenesen...tárold el globálisan... new AVO[MAX_VEHICLES]; // Attach Vehicle Objects // tárgy id-k tárolásáraparancs:{new vid = GetPlayerVehicleID(playerid);if(!vid) { return 1; } // nincs jármûbenif(AVO[vid]) { DestroyObject(AVO[vid]); } // ha létre van hozva a tárgy töröljeAVO[vid] = CreateObject(19419,0.0,0.0,0.0,0.0,0.0,0.0); // tárgy létrehozás AttachObjectToVehicle(AVO[vid],vid,-0.024999,0.024999,0.794999,0.0,0.0,0.0); // tárgy csatolásreturn 1;} ezzel annyi a gond hogy minden jármûnek létrehozok 1 cellát vele mert most nincs kedvem belebonyolódni ebbe a témába...ezen felül létezik több megoldás is az adat tárolásra, ha néhány jármûre akarod használni jobban megéri kevesebb ramot foglalni...
if(AVO[vid])
if(IsValidObject(AVO[vid]))
#include <a_samp>new szirena[MAX_PLAYERS][3];public OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\" Sziréna by RedDev (founded by Red-Eye)\");print(\"--------------------------------------\\n\");return 1;}public OnFilterScriptExit(){for(new i=0;i < MAX_PLAYERS;i++){szirena[1] = 0;}return 1;}public OnPlayerConnect(playerid){return 1;}public OnPlayerDisconnect(playerid, reason){ szirena[playerid][1] = 0;return 1;} public OnPlayerCommandText(playerid, cmdtext[]){if (strcmp(\"/szirena\", cmdtext, true, 10) == 0){ if(szirena[playerid][1] == 0) { szirena[playerid][0] = CreateObject(18646, -0.45, -0.09, 0.89, 0.00, 0.00, 0.00); szirena[playerid][1] = 1; new vehicleid = GetPlayerVehicleID(playerid); szirena[playerid][2] = vehicleid; new modelke = GetVehicleModel(vehicleid); switch(modelke){ case 445: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.45, -0.09, 0.89, 0.00, 0.00, 0.00); case 507: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.45, -0.25, 0.85, 0.00, 0.00, 0.00); case 426: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.49, -0.07, 0.87, 0.00, 0.00, 0.00); case 551: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.37, -0.05, 0.93, 0.00, 0.00, 0.00); case 405: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.43, -0.06, 0.79, 0.00, 0.00, 0.00); case 489: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.61, -0.08, 1.13, 0.00, 0.00, 0.00); case 560: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.50, 0.14, 0.87, 0.00, 0.00, 0.00); case 421: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.42, 0.16, 0.73, 0.00, 0.00, 0.00); case 409: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.42, 0.86, 0.85, 0.00, 0.00, 0.00); case 411: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.44, 0.18, 0.71, 0.00, 0.00, 0.00); case 415: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.31, -0.23, 0.65, 0.00, 0.00, 0.00); case 428: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.01, 1.52, 0.54, 0.00, 0.00, 0.00); case 451: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.37, -0.30, 0.61, 0.00, 0.00, 0.00); case 470: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.80, 0.26, 1.12, 0.00, 0.00, 0.00); case 528: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.54, 0.28, 1.10, 0.00, 0.00, 0.00); case 541: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.39, 0.05, 0.68, 0.00, 0.00, 0.00); case 579: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.59, 0.06, 1.27, 0.00, 0.00, 0.00); case 580: AttachObjectToVehicle(szirena[playerid][0], vehicleid, -0.64, 0.31, 1.07, 0.00, 0.00, 0.00); case 603: AttachObjectToVehicle(szirena[playerid][0], vehicleid,-0.48, -0.26, 0.70, 0.00, 0.00, 0.00); }}else if(szirena[playerid][1] == 1){if(GetPlayerVehicleID(playerid) != szirena[playerid][2]) return SendClientMessage(playerid,0xFFFFF,\"Már raktál egy kocsira, hogy levedd ülj be abba amibe raktad\");DestroyObject(szirena[playerid][0]);szirena[playerid][1] = 0;}return 1;}if (strcmp(\"/admiral\", cmdtext, true, 10) == 0){ new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z);AddStaticVehicle(445,X+1,Y+1,Z,0,0,0);return 1;}return 0;}
+ vedd ajándéknak a lementett kocsis sziréna helyzeteket