HELP | The car spawned will destroy!
#5

Hi,

First, change:
pawn Код:
Text3D:vehicle3Dtext;
to:
pawn Код:
Text3D:vehicle3Dtext[MAX_PLAYERS];
The command:
pawn Код:
dcmd_v(playerid,params[])
{
    if(SpanedV[playerid]!=0) return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a vehicle");
    //Bla bla ...
    SpawnedV[playerid] = CreateVehicle(car, X,Y,Z, Angle, colour1, colour2, -1);
    format(string, sizeof(string), "Spawned Vehicle");
    vehicle3Dtext[playerid] = Create3DTextLabel(string,RED,X,Y,Z,140.0,0);
    Attach3DTextLabelToVehicle(vehicle3Dtext[playerid], SpawnedV[playerid], 0.0, 0.0, 2.0);
    return 1;
}
OnFilterScriptExit:
pawn Код:
public OnFilterScriptExit()
{
    for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ )
    {
        if(SpawnedV[playerid] != -1)
        {
            DestroyVehicle(SpawnedV[playerid]);
            SpawnedV[playerid]=-1;
            Delete3DTextLabel(vehicle3Dtext[playerid]);
        }
    }
    return 1;
}
And OnPlayerDisconnect:
pawn Код:
public OnPlayerDisconnect(playerid)
{
    if(SpawnedV[playerid] != -1)
    {
        DestroyVehicle(SpawnedV[playerid]);
        SpawnedV[playerid]=-1;
        Delete3DTextLabel(vehicle3Dtext[playerid]);
    }
    return 1;
}
And you have to add under OnFilterScriptInit:
pawn Код:
public OnFilterScriptInit()
{
    for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ ) SpanedV[playerid]=-1;
    return 1;
}
If you have any questions, just ask.


Jeffry
Reply


Messages In This Thread
HELP | The car spawned will destroy! - by Yaszine - 02.01.2011, 18:12
Re : HELP | The car spawned will destroy! - by Yaszine - 02.01.2011, 18:14
Re : HELP | The car spawned will destroy! - by Yaszine - 02.01.2011, 19:55
Re : HELP | The car spawned will destroy! - by Yaszine - 03.01.2011, 17:32
Re: HELP | The car spawned will destroy! - by Jeffry - 03.01.2011, 17:40
Re : HELP | The car spawned will destroy! - by Yaszine - 04.01.2011, 12:04
Re: HELP | The car spawned will destroy! - by Vince - 04.01.2011, 12:10
Re: HELP | The car spawned will destroy! - by Kwarde - 04.01.2011, 14:05
Re: Re : HELP | The car spawned will destroy! - by Jeffry - 05.01.2011, 08:27
Re : Re: Re : HELP | The car spawned will destroy! - by Yaszine - 05.01.2011, 11:45

Forum Jump:


Users browsing this thread: 1 Guest(s)