SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/07/2012, 04:59 PM   #1
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default Create Object Behind Vehicle

Hello Community,
im searching for an Solution:

How can i Create a Object behind a Dune ?
So its wayne if i stay to North or S ?

I tryed it abit but failed
can someone help me ?
It's for a Lazeret Script

pawn Code:
stock CreateLazeret(playerid, Float:vehiclelength)
{
    new Float:x,Float:y,Float:z,Float:a;
    new vID = GetPlayerVehicleID(playerid);
    GetVehiclePos(vID, x, y, z);
    GetPlayerFacingAngle(vID, a);
    x += (vehiclelength* floatsin(-a, degrees));
    y += (vehiclelength* floatcos(-a, degrees));
    Object = CreateDynamicObject(1997, x, y-5.5, z-2.20, 0.0, 0.0, a, 0, 0);
    //return IsPlayerInRangeOfPoint(playerid,radius,x,y,z);
    return 1;
}
Tigerkiller is offline   Reply With Quote
Old 08/07/2012, 05:54 PM   #2
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,336
Reputation: 719
Default Re: Create Object Behind Vehicle

Try replace
pawn Code:
x += (vehiclelength* floatsin(-a, degrees));
y += (vehiclelength* floatcos(-a, degrees));
With
pawn Code:
x -= (vehiclelength* floatsin(-a, degrees));
y -= (vehiclelength* floatcos(-a, degrees));
__________________




CONTATO: F A C E B O O K: @vinibornpawn


GameMode = Modo de jogo = Masculino
Colabore com os olhos de quem lê. Não diga "Minha GM"!
ViniBorn is offline   Reply With Quote
Old 08/07/2012, 06:31 PM   #3
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default AW: Create Object Behind Vehicle

Not working. Someone else has an idea ?
Tigerkiller is offline   Reply With Quote
Old 10/07/2012, 03:00 PM   #4
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,182
Reputation: 504
Default Re: Create Object Behind Vehicle

pawn Code:
stock CreateLazeret(playerid, Float:vehiclelength)
{
    new Float:x, Float:y, Float:z, Float:angle, vID = GetPlayerVehicleID(playerid),
        Float:sX, Float:sY, Float:sZ;
    GetVehiclePos(vID, x, y, z);
    GetPlayerFacingAngle(vID, angle);
    GetVehicleModelInfo(GetVehicleModel(vID), VEHICLE_MODEL_INFO_SIZE, sX, sY, sZ);
    sY /= 1.7;
    y += (sY * floatcos(-angle, degrees));
    Object = CreateDynamicObject(1997, x, y, z - 2.20, 0.0, 0.0, a, 0, 0);
    //return IsPlayerInRangeOfPoint(playerid,radius,x,y,z);
    return 1;
}
Kar is offline   Reply With Quote
Old 11/07/2012, 10:26 PM   #5
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default AW: Create Object Behind Vehicle

Not working - if i stand too North it wont works but if i stand too Sudth it works

any other ideas please?

i need it
Tigerkiller is offline   Reply With Quote
Old 12/07/2012, 12:31 AM   #6
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,182
Reputation: 504
Default Re: Create Object Behind Vehicle

What you mean that doesn't work?? tell me exactly what you want.
Kar is offline   Reply With Quote
Old 12/07/2012, 02:48 AM   #7
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default AW: Create Object Behind Vehicle

I want it so:
If i type a Command -> And Object Spawns Behind the Dune (like a Container) ->
The object is to always stand behind the dune, no matter which way I am.
The code is up to now only if I am in the north, but I do not know why

@****** Translator - Sorry - Hope you know what i mean
Tigerkiller is offline   Reply With Quote
Old 12/07/2012, 03:09 AM   #8
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,182
Reputation: 504
Default Re: Create Object Behind Vehicle

pawn Code:
stock CreateLazeret(playerid, Float:vehiclelength)
{
    new Float:x, Float:y, Float:z, Float:angle, vID = GetPlayerVehicleID(playerid),
        Float:sX, Float:sY, Float:sZ;
    GetVehiclePos(vID, x, y, z);
    GetPlayerFacingAngle(vID, angle);
    GetVehicleModelInfo(GetVehicleModel(vID), VEHICLE_MODEL_INFO_SIZE, sX, sY, sZ);
    sX /= 2.0;
    sY /= 1.7;
    x += (sX * floatsin(-angle, degrees));
    y += (sY * floatcos(-angle, degrees));
    Object = CreateDynamicObject(1997, x, y, z - 2.20, 0.0, 0.0, a, 0, 0);
    //return IsPlayerInRangeOfPoint(playerid,radius,x,y,z);
    return 1;
}

try that
Kar is offline   Reply With Quote
Old 12/07/2012, 03:32 AM   #9
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default AW: Create Object Behind Vehicle

This one doesnt works too -.-
Tigerkiller is offline   Reply With Quote
Old 13/07/2012, 11:31 PM   #10
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 744
Reputation: 25
Default AW: Create Object Behind Vehicle

Bump - still need it
Tigerkiller is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with the next Vehicle model and command create vehicle. Newer Help Archive 1 23/03/2011 09:13 PM
How to convert the vehicle lists to Create vehicle for each line Gabe713 Help Archive 1 05/10/2009 04:12 PM
Object Create (2) Starskyyy Help Archive 19 04/03/2009 07:40 PM
Object Create Starskyyy Help Archive 1 04/03/2009 04:02 PM


All times are GMT. The time now is 01:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.