[Help] Attaching Object To Player? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Attaching Object To Player? (
/showthread.php?tid=262961)
[Help] Attaching Object To Player? -
Tommy_Mandaz - 20.06.2011
I am trying to make it when the person types /cone it attaches the traffic cone object to their hand, but why is this not working? Thanks. And for the gLastCar, when the person exits the vehicle it sets that vehicle's ID to their gLastCar. Thanks!
pawn Code:
CMD:cone(playerid, params[])
{
new string[128], sendername[MAX_PLAYER_NAME];
new oldcar = gLastCar[playerid];
if(gPlayerInfo[playerid][pFaction] == 1)
{
if(oldcar == 413)
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(ItemHolding[playerid] == 0)
{
new Float:tx,Float:ty,Float:tz;
GetVehiclePos(oldcar, tx, ty, tz);
if(IsPlayerInRangeOfPoint(playerid, 10, tx, ty, tz))
{
ItemHolding[playerid] = 1;
SetPlayerAttachedObject(playerid,5,1210,6,0.271233, 0.078992, 0.041259, 0.349204, 260.329711, 358.628845,0.0,1);
Fmsg("%s opens the back of the truck and takes out a traffic cone", sendername);
SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not near the truck!");
}
}
else
{
RemovePlayerAttachedObject(playerid, 5);
Fmsg("%s opens the back of the truck and puts a traffic cone inside", sendername);
SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
}
}
}
return 1;
}
Re: [Help] Attaching Object To Player? -
Tommy_Mandaz - 20.06.2011
Anyone able to please assist me with my problem?
Re: [Help] Attaching Object To Player? -
PrawkC - 20.06.2011
if(oldcar == 413) .... Is 413 the model ID of the car?
Re: [Help] Attaching Object To Player? -
Horrible - 20.06.2011
Quote:
Originally Posted by Tommy_Mandaz
I am trying to make it when the person types /cone it attaches the traffic cone object to their hand, but why is this not working? Thanks. And for the gLastCar, when the person exits the vehicle it sets that vehicle's ID to their gLastCar. Thanks!
pawn Code:
CMD:cone(playerid, params[]) { new string[128], sendername[MAX_PLAYER_NAME]; new oldcar = gLastCar[playerid]; if(gPlayerInfo[playerid][pFaction] == 1) { if(oldcar == 413) { if(!IsPlayerInAnyVehicle(playerid)) { if(ItemHolding[playerid] == 0) { new Float:tx,Float:ty,Float:tz; GetVehiclePos(oldcar, tx, ty, tz); if(IsPlayerInRangeOfPoint(playerid, 10, tx, ty, tz)) { ItemHolding[playerid] = 1; SetPlayerAttachedObject(playerid,5,1210,6,0.271233, 0.078992, 0.041259, 0.349204, 260.329711, 358.628845,0.0,1); Fmsg("%s opens the back of the truck and takes out a traffic cone", sendername); SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE); return 1; } else { SendClientMessage(playerid, COLOR_RED, "You are not near the truck!"); } } else { RemovePlayerAttachedObject(playerid, 5); Fmsg("%s opens the back of the truck and puts a traffic cone inside", sendername); SLM(playerid, string, 15, COLOR_PURPLE, COLOR_PURPLE); return 1; } } } } return 1; }
|
Quote:
if(oldcar == 413)
{
Change to this ======> if(model == 413)
{
|
^ if u mean old car is car model
Re: [Help] Attaching Object To Player? -
Tommy_Mandaz - 20.06.2011
But why do I put model? Is there a specific reason for it or something?
Re: [Help] Attaching Object To Player? -
Horrible - 21.06.2011
Quote:
Originally Posted by Tommy_Mandaz
But why do I put model? Is there a specific reason for it or something?
|
u put model coz when player enter that vehicle model player will attach with that object
and if u want all vehicle model just delete
[pawno]if(model == 413)
{[/pawno]
as i remeber ^