SA-MP Forums Archive
siren help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: siren help (/showthread.php?tid=202033)



siren help - farris - 23.12.2010

hey guys i build a command to add sirens to cars but the remove command doesnt work im going to show youll both the add and the remove code



Quote:

if(strcmp(cmd, "/code3", true) == 0)
{
if(IsACop(playerid))
{
new vehicleid;
new siren;
siren = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(siren, vehicleid, 0.0, 0.0, GetVehicleHeightForSiren(vehicleid)+2, 0.0, 0.0, 0.0);
}
else SendClientMessage(playerid, LIGHTBLUE, "You may not use this Command!");
return 1;
}
if(strcmp(cmd, "/code1", true) == 0)
{
if(IsACop(playerid))
{
DestroyObject(siren);
}
else SendClientMessage(playerid, LIGHTBLUE, "You may not use this Command!");
return 1;
}




Re: siren help - stix - 23.12.2010

you need to get the vehicleid

otherwise the server wont know what to do


Re: siren help - farris - 23.12.2010

more specific?


Re: siren help - stix - 23.12.2010

new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);

add this to code1 command


Re: siren help - Austin - 23.12.2010

No, your siren is a local variable and not a global variable.


Re: siren help - Donuts - 23.12.2010

change 'new siren;' to the first part of your script, below the includes.


Re: siren help - Geso - 23.12.2010

Quote:
Originally Posted by farris
Посмотреть сообщение
hey guys i build a command to add sirens to cars but the remove command doesnt work im going to show youll both the add and the remove code
pawn Код:
new siren[MAX_VEHICLES]; //at top of your script

if(strcmp(cmd, "/code3", true) == 0)
{
if(IsACop(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
siren[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(siren, vehicleid, 0.0, 0.0, GetVehicleHeightForSiren(vehicleid)+2, 0.0, 0.0, 0.0);
}
else SendClientMessage(playerid, LIGHTBLUE, "You may not use this Command!");
return 1;
}
if(strcmp(cmd, "/code1", true) == 0)
{
if(IsACop(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
DestroyObject(siren[vehicleid]);
}
else SendClientMessage(playerid, LIGHTBLUE, "You may not use this Command!");
return 1;
}

try this


Re: siren help - farris - 24.12.2010

geso your code works when i put on to the attatch object part of code 3 other wise i got 3 errors but now its fixed


Re: siren help - Geso - 24.12.2010

cool, nice to know you're happy with it


AW: siren help - xSonYx - 25.05.2012

1 Error: C:\Users\Timo\Desktop\SAMP Server\gamemodes\Script.pwn(375) : error 035: argument type mismatch (argument 1)

Line 375: if(strcmp(cmdtext, "/sirenean", true) == 0)
{
if(IstSpielerInFraktion(playerid, 4))
{
new vehicleid = GetPlayerVehicleID(playerid);
siren[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(siren,vehicleid,0.0, 0.0, GetVehicleHeightForSiren(vehicleid)+2, 0.0, 0.0, 0.0);//That is Line 375
}
else SendClientMessage(playerid, Rot,"Du bist nicht beim LSPD!");
return 1;
}