dcmd_v(playerid,params[])
{
//Bla bla ...
SpawnedV[playerid] = CreateVehicle(car, X,Y,Z, Angle, colour1, colour2, -1);
format(string, sizeof(string), "Spawned Vehicle");
vehicle3Dtext = Create3DTextLabel(string,RED,X,Y,Z,140.0,0);
Attach3DTextLabelToVehicle(vehicle3Dtext, SpawnedV[playerid], 0.0, 0.0, 2.0);
}
public OnFilterScriptExit()
{
for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ )
if(SpawnedV[playerid] == 1) {DestroyVehicle(SpawnedV[playerid]); Delete3DTextLabel(Text3D:vehicle3Dtext); }
return 0;//1
}
public OnPlayerDisconnect(playerid)
{
if(SpawnedV[playerid] == 1){DestroyVehicle(SpawnedV[playerid]); Delete3DTextLabel(Text3D:vehicle3Dtext);}
return 0;
}
Text3D:vehicle3Dtext;
Text3D:vehicle3Dtext[MAX_PLAYERS];
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;
}
public OnFilterScriptExit()
{
for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ )
{
if(SpawnedV[playerid] != -1)
{
DestroyVehicle(SpawnedV[playerid]);
SpawnedV[playerid]=-1;
Delete3DTextLabel(vehicle3Dtext[playerid]);
}
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(SpawnedV[playerid] != -1)
{
DestroyVehicle(SpawnedV[playerid]);
SpawnedV[playerid]=-1;
Delete3DTextLabel(vehicle3Dtext[playerid]);
}
return 1;
}
public OnFilterScriptInit()
{
for(new playerid = 0; playerid < GetMaxPlayers(); playerid ++ ) SpanedV[playerid]=-1;
return 1;
}
And you have to add under OnFilterScriptInit:
pawn Код:
|
new
SpawnedV[MAX_PLAYERS] = {-1,...};
// Just like that (with the ellipsis in place). Will set every index in the array to -1 when it's created.
Or you could do (just a tip):
pawn Код:
|
Jeffry, You're a high scripter
Question: Can you give me /callcar, for calling the SpawnedV ?! Thanks |
Do you mean, you type /callcar and YOUR SpawnedV Car will be set to your position?
|