SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 02/12/2019, 01:41 PM   #1
bookknp
Huge Clucker
 
bookknp's Avatar
 
Join Date: Dec 2013
Posts: 243
Reputation: 24
Question Question about object dont go through walls

Hi guys, how can I make an object with the "moveobject" command not pass through walls or floor??.

I have tried using Colnadreas and the physics.inc plugin, but dont work for me ...

Could you give me an example?? +rep

Last edited by bookknp; 02/12/2019 at 03:27 PM.
bookknp is offline   Reply With Quote
Old 03/12/2019, 02:36 PM   #2
bookknp
Huge Clucker
 
bookknp's Avatar
 
Join Date: Dec 2013
Posts: 243
Reputation: 24
Default Re: Question about object dont go through walls

Someone can help me?? i give +rep
bookknp is offline   Reply With Quote
Old 04/12/2019, 01:01 PM   #3
Tellken
Huge Clucker
 
Tellken's Avatar
 
Join Date: Jan 2012
Location: Barcelona
Posts: 335
Reputation: 458
Default Re: Question about object dont go through walls

pawn Code:
new Aero;
new bool:HoldingKey[MAX_PLAYERS];

public OnGameModeInit()
{
Aero = CreateDynamicObject(19336, -2880.530029, 1237.689941, 6.05, 0.0, 0.0, 0.0);
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_YES && !HoldingKey[playerid])
{
KeyCheck(playerid);
HoldingKey[playerid] = true;
}
return 1;
}

forward KeyCheck(playerid);
public KeyCheck(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new
            keys, ud, lr;

        GetPlayerKeys(playerid, keys, ud, lr);
        new Float: pos[3];
        GetDynamicObjectPos(Aero, pos[0], pos[1], pos[2]);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, pos[0], pos[1], pos[2]))
        {

        if(keys & KEY_YES)
        {
         new Float:rx, Float:rz, Float:x, Float:y, Float:z, Float:tx, Float:ty, Float:tz;
         new Float:endx, Float:endy, Float:endz, wall;
         GetPlayerCameraRotation(playerid,rx,rz);
         GetPlayerPos(playerid,x,y,z);
         GetPointInFront3D(x,y,z,rx,rz,2.5,tx,ty,tz);
         MoveDynamicObject(Aero, tx,ty,tz,1.5);
         wall = CA_RayCastLine(x,y,z, tx,ty,tz, endx,endy,endz);
         if(wall != 0) StopDynamicObject(Aero);

          SetTimerEx("KeyCheck", 100, 0, "i", playerid);

          return 0;
         }}
    }
         HoldingKey[playerid] = false;

return 0;
}
__________________
↖__________↗
My Maps
↙ŻŻŻŻŻŻŻŻŻŻ↘
Tellken 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
Object dont load properly ignas1125 Scripting Help 5 08/12/2014 09:00 PM
[Help]dont show object Nedda Scripting Help 4 30/06/2013 01:25 AM
[Include] New walls using SetObejectMaterial. 70 New Walls! adri1 Includes 7 23/03/2013 10:58 AM
Dont create object arman'as Scripting Help 1 04/08/2012 08:20 PM


All times are GMT. The time now is 06:52 PM.


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