Nos sziasztok, megpróbáltam megcsinálni a GFben a szirénát.
A következõ képpen:
-Csak bizonyos típusú autókra lehet szirénát rakni.
-Csak rendvédelmisek tudják használni.
-Létre hoztam a köveketkezõ változókat: siren[MAX_VEHICLES], siren2[MAX_PLAYERS].
Lefordítottam és minden oké volt.
VISZONT
Azzal a kellemetlen buggal szembesültem,hogy ha beülök a kocsiba felteszem a szirénát azt nem tudom levenni. Arról a kocsiról amire elsõnek raktam. A többire fel is tudom rakni a szirénát és le is tudom venni. Csak az elsõ autó rakoncátlankodik, mi lehet a gond?
[pawn] if(strcmp(cmd,\"/sziréna\", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid) || TEK(playerid) || NNI(playerid) || VPOP(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new x_nr[256];
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == INVALID_VEHICLE_ID) return 1;
new tipus = GetVehicleModel(vehicleid);
new siren[MAX_VEHICLES];
siren[vehicleid]=1;
new hasznalat[MAX_PLAYERS];
hasznalat[playerid]=hasznalat[playerid]+1;
siren2[vehicleid]=hasznalat[playerid];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, \"[Használat]: /sziréna [fel/le]\");
}
else if(strcmp(x_nr,\"fel\",true) == 0)
{
if(siren2[vehicleid]==1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), \"* %s felszerelte a megkülönböztetõ jelzést.\", sendername);
ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(tipus == 560)
{
siren[vehicleid] = CreateObject(18646, -0.35644531250, 0.0388183593, 0.863788605, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.35644531250, 0.0388183593, 0.863788605, 0.0, 0.0, 0.0);
siren2[vehicleid] = 4;
SendClientMessage(playerid, COLOR_GREEN, \" Sziréna felszerelve! \");
}
else if(tipus == 415)
{
siren[vehicleid] = CreateObject(18646, -0.290039062, -0.284179688, 0.631957054, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.290039062, -0.284179688, 0.631957054, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 421)
{
siren[vehicleid] = CreateObject(18646, -0.323303223, 0.0207519532, 0.731482506, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.323303223, 0.0207519532, 0.731482506, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 426)
{
siren[vehicleid] = CreateObject(18646, 0.575378418, 0.786132812, 0.361483574, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.575378418, 0.786132812, 0.361483574, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 579)
{
siren[vehicleid] = CreateObject(18646, -0.442626953, -0.269042969, 1.27014542, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.442626953, -0.269042969, 1.27014542, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 402)
{
siren2[vehicleid] = CreateObject(18646, -0.412841797, -0.474365234, 0.778804779, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.412841797, -0.474365234, 0.778804779, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 544)
{
siren[vehicleid] = CreateObject(18646, 0.522338867, 2.5925293, 1.46867275, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.522338867, 2.5925293, 1.46867275, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 528)
{
siren[vehicleid] = CreateObject(18646, 0.563842773, 0.754882812, 0.487258911, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.563842773, 0.754882812, 0.487258911, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 461)
{
siren[vehicleid] = CreateObject(18646, 0.00000000, -0.932861328, 0.494509697, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.00000000, -0.932861328, 0.494509697, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 521)
{
siren[vehicleid] = CreateObject(18646, 0.00000000, -0.928955078, 0.558652878, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.00000000, -0.928955078, 0.558652878, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 586)
{
siren[vehicleid] = CreateObject(18646, 0.00000000, -1.20178223, 0.671886444, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.00000000, -1.20178223, 0.671886444, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 506)
{
siren[vehicleid] = CreateObject(18646, 0.541137695, 0.282714844, 0.272130013, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, 0.541137695, 0.282714844, 0.272130013, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 482)
{
siren[vehicleid] = CreateObject(18646, -0.392211914, 0.565551758, 0.941601753, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.392211914, 0.565551758, 0.941601753, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 470)
{
siren[vehicleid] = CreateObject(18646, -0.617797851, 0.056640625, 1.10928631, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.617797851, 0.056640625, 1.10928631, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else if(tipus == 433)
{
siren[vehicleid] = CreateObject(18646, -0.577392578, 1.23217773, 1.70311642, 0.0, 0.0, 96.0);
AttachObjectToVehicle(siren[vehicleid], vehicleid, -0.577392578, 1.23217773, 1.70311642, 0.0, 0.0, 0.0);
siren2[vehicleid]=4;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna felszerelve!\");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \"Erre a kocsira nem tehetsz szirénát!\");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \"Már tettél fel szirénát\");
}
}
else if(strcmp(x_nr,\"le\",true) == 0)
{
if(siren2[vehicleid] ==4)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), \"* %s leszerelte a megkülönböztetõ jelzést.\", sendername);
ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
DestroyObject(siren[vehicleid]);
siren2[vehicleid]=1;
SendClientMessage(playerid, COLOR_GREEN, \"Sziréna leszedve !\");
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \"Nincs fent sziréna\");
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \"Nincs ilyen parancs!\");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \" Mire akarsz szirénát rakni?\");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy rendvédelmis!\");
}
}
return 1;
}[/pawn]
Hiba jelzés nélkül lefut..