03.01.2011, 17:40
Hi,
First, change:
to:
The command:
OnFilterScriptExit:
And OnPlayerDisconnect:
And you have to add under OnFilterScriptInit:
If you have any questions, just ask.
Jeffry
First, change:
pawn Код:
Text3D:vehicle3Dtext;
pawn Код:
Text3D:vehicle3Dtext[MAX_PLAYERS];
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;
}
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;
}
pawn Код:
public OnPlayerDisconnect(playerid)
{
if(SpawnedV[playerid] != -1)
{
DestroyVehicle(SpawnedV[playerid]);
SpawnedV[playerid]=-1;
Delete3DTextLabel(vehicle3Dtext[playerid]);
}
return 1;
}
pawn Код:
public OnFilterScriptInit()
{
for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ ) SpanedV[playerid]=-1;
return 1;
}
Jeffry