siren help
#1

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;
}

Reply
#2

you need to get the vehicleid

otherwise the server wont know what to do
Reply
#3

more specific?
Reply
#4

new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);

add this to code1 command
Reply
#5

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

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

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
Reply
#8

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
Reply
#9

cool, nice to know you're happy with it
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)