SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 15/05/2012, 07:25 PM   #1
CidadeNovaRP
High-roller
 
CidadeNovaRP's Avatar
 
Join Date: Mar 2012
Posts: 1,120
Reputation: 98
Default Simple Include - Add Virtual Word to your Objects

The title says it all, just use the function:
CreateObjectEx (model, Float: x, Float: y, Float: z, Float: rx, Float: ry, Float: rz, Float: draw, virtualword)

This is CODE:
pawn Code:
#include <a_samp>

new Timer[MAX_PLAYERS];

enum OInfo
{
    Model,
    Float:X,
    Float:Y,
    Float:Z,
    Float:RX,
    Float:RY,
    Float:RZ,
    Float:DRAW,
    VirtualWord,
    bool:Criado[MAX_PLAYERS],
    Objeto
};

new Objetos, ObjectInfo[MAX_OBJECTS][OInfo];

public OnPlayerConnect(playerid)
{
    Timer[playerid] = SetTimerEx("AtualizarObjetos", 1500, true, "i", playerid);
    return 1;
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect object_OnPlayerConnect
forward object_OnPlayerConnect(playerid);

public OnPlayerDisconnect(playerid)
{
    KillTimer(Timer[playerid]);
    return 1;
}

#if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect object_OnPlayerDisconnect
forward object_OnPlayerDisconnect(playerid);

stock CreateObjectEx(model, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:draw, virtualword)
{
    Objetos ++;
    if(Objetos >= MAX_OBJECTS) return print("Limete de Objetos Exedido"), Objetos --;
    ObjectInfo[Objetos][VirtualWord] = virtualword;
    ObjectInfo[Objetos][Model] = model;
    ObjectInfo[Objetos][X] = x;
    ObjectInfo[Objetos][Y] = y;
    ObjectInfo[Objetos][Z] = z;
    ObjectInfo[Objetos][RX] = rx;
    ObjectInfo[Objetos][RY] = ry;
    ObjectInfo[Objetos][RZ] = rz;
    ObjectInfo[Objetos][DRAW] = draw;
    return 1;
}

forward AtualizarObjetos(playerid);
public AtualizarObjetos(playerid)
{
    new o;
    while(o < MAX_OBJECTS)
    {
        if(GetPlayerVirtualWorld(playerid) == ObjectInfo[o][VirtualWord])
        {
            if(IsPlayerInRangeOfPoint(playerid, ObjectInfo[o][DRAW], ObjectInfo[o][X], ObjectInfo[o][Y], ObjectInfo

[o][Z]))
            {
                if(ObjectInfo[o][Criado][playerid] == false)
                {
                    ObjectInfo[o][Objeto] = CreatePlayerObject(playerid, ObjectInfo[o][Model], ObjectInfo[o]

[X], ObjectInfo[o][Y], ObjectInfo[o][Z], ObjectInfo[o][RX], ObjectInfo[o][RY], ObjectInfo[o][RX], ObjectInfo[o][DRAW]);
                    ObjectInfo[o][Criado][playerid] = true;
                }
            }
            else
            {
                ObjectInfo[o][Criado][playerid] = false;
                DestroyPlayerObject(playerid, ObjectInfo[o][Objeto]);
            }
        }
        else
        {
            ObjectInfo[o][Criado][playerid] = false;
            DestroyPlayerObject(playerid, ObjectInfo[o][Objeto]);
        }
        o++;
    }
}

native CreateObjectEx(model, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:draw, virtualword);

I hope you enjoy .
__________________
Eae Cidade, viu a versão 0.3x do SA-MP?
Onde?
Ta no fórum
To
CidadeNovaRP 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
Help With objects and virtual world! Elmerz_com Scripting Help 8 08/07/2012 05:15 PM
If I create the objects in virtual worlds that makes room for other objects? tal_peretz Help Archive 8 17/05/2011 01:48 PM
Objects Virtual World Dime Help Archive 4 07/10/2010 10:09 AM
Objects in Virtual World MummyKillerSLO Help Archive 4 28/04/2010 09:06 PM


All times are GMT. The time now is 10:39 AM.


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