Just need 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: Just need help !! (
/showthread.php?tid=406924)
Just need help !! -
Unirom Shaw - 12.01.2013
Hello anyone, i create this script
pawn Код:
if (strcmp("/siren", cmdtext, true, 10) == 0)
{
new objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000);
SendClientMessage(playerid, red, "You've Added a siren to your vehicle");
return 1;
}
Then how to remove the object ?
Re: Just need help !! -
[HK]Ryder[AN] - 12.01.2013
https://sampwiki.blast.hk/wiki/DestroyObject
Re: Just need help !! -
Diorturato - 12.01.2013
Firstly, save an objectid, after destroy it by id.
Re: Just need help !! -
EAsT-OAK_510 - 12.01.2013
You can try this:
pawn Код:
if (strcmp("/siren", cmdtext, true, 10) == 0)
{
new veh, objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
veh = GetPlayerVehicleID(playerid);
if(!Siren[veh])
{
AttachObjectToVehicle(objectid, veh, 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000);
SendClientMessage(playerid, red, "You've Added a siren to your vehicle");
Siren[veh] = 1;
return 1;
}
else
{
DestroyObject(objectid[veh]);
Siren[veh] = 0;
SendClientMessage(playerid, red, "You've removed a siren from your vehicle");
return 1;
}
return 1;
}
Re: Just need help !! -
Threshold - 12.01.2013
This will fit the bill:
pawn Код:
new Siren[MAX_VEHICLES];
new SObj[MAX_VEHICLES];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/siren", cmdtext, true) == 0)
{
new veh;
veh = GetPlayerVehicleID(playerid);
if(!Siren[veh])
{
SObj[veh] = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(SObj[veh], veh, 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000);
SendClientMessage(playerid, red, "You've Added a siren to your vehicle");
Siren[veh] = 1;
return 1;
}
else
{
DestroyObject(SObj[veh]);
Siren[veh] = 0;
SendClientMessage(playerid, red, "You've removed a siren from your vehicle");
return 1;
}
return 1;
}
return 0;
}
@EAsT-OAK_510 - Just noticed your signature
Re: Just need help !! -
EAsT-OAK_510 - 12.01.2013
Quote:
Originally Posted by BenzoAMG
This will fit the bill:
pawn Код:
new Siren[MAX_VEHICLES]; new SObj[MAX_VEHICLES];
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp("/siren", cmdtext, true) == 0) { new veh; veh = GetPlayerVehicleID(playerid); if(!Siren[veh]) { SObj[veh] = CreateObject(19419, 0, 0, 0, 0, 0, 0); AttachObjectToVehicle(SObj[veh], veh, 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000); SendClientMessage(playerid, red, "You've Added a siren to your vehicle"); Siren[veh] = 1; return 1; } else { DestroyObject(SObj[veh]); Siren[veh] = 0; SendClientMessage(playerid, red, "You've removed a siren from your vehicle"); return 1; } return 1; } return 0; }
@EAsT-OAK_510 - Just noticed your signature ![Grin](images/smilies/biggrin.gif)
|
Heh, since I am learning a lot now I said I should as well try helping out, whether if I am right or wrong. Like that I can know how "good" I am. And thanks for editing the code a bit for me.
Re: Just need help !! -
InActtive™ - 12.01.2013
This may be a useless post but, did any of you notice eachothers' signatures?
Re: Just need help !! -
Threshold - 12.01.2013
Yeah IKR, he copied me :P
Re: Just need help !! -
EAsT-OAK_510 - 12.01.2013
I modified his and put it onto mine.