07.03.2013, 13:59
(
Последний раз редактировалось rangerxxll; 07.03.2013 в 14:04.
Причина: Small error.
)
Hi.
I've been experimenting with foreach, and so far I really enjoy working with it. But I'm trying to create a command, where it'll put everyone online into vehicle x. I'm checking if the players are in any vehicle, and IF they are I remove them before creating a new one for them. That's my goal.
But the thing is; the code seems to be working (Sort of.) but in-game it still says their name tag (And even shows their skin.) on their old vehicle, when they're driving the new one.
How can I fix this error? I'll show you my current code.
Any help is greatly appreciated as always. Thanks.
I've been experimenting with foreach, and so far I really enjoy working with it. But I'm trying to create a command, where it'll put everyone online into vehicle x. I'm checking if the players are in any vehicle, and IF they are I remove them before creating a new one for them. That's my goal.
But the thing is; the code seems to be working (Sort of.) but in-game it still says their name tag (And even shows their skin.) on their old vehicle, when they're driving the new one.
How can I fix this error? I'll show you my current code.
Any help is greatly appreciated as always. Thanks.
pawn Код:
CMD:vehall(playerid, params[])
{
new vstring[128], id;
if(PlayerInfo[playerid][pAdmin] >=2)
{
foreach ( new i : Player)
{
new Float:X, Float:Y, Float:Z, Float:A, col1, col2;
if(sscanf(params, "iii", id, col1, col2)) return SendClientMessage(playerid, -1, "/veh [VehID][Col1][Col2]");
if(IsPlayerInAnyVehicle(i))
{
RemovePlayerFromVehicle(i);
}
if(id < 400 || id > 611) return SendClientMessage(playerid, -1, "Vehicle IDs are only 400 - 611");
GetPlayerFacingAngle(i, A);
GetPlayerPos(i, X,Y,Z);
id = CreateVehicle(id, X, Y, Z, A, col1, col2, 600);
PutPlayerInVehicle(i, id, 0);
}
format(vstring,sizeof(vstring), "AdmCmd: %s %s has put everyone online into vehicle ID: %d.",GetAdminLvlName(playerid),GetName(playerid),id);
SendClientMessageToAll(COLOR_ORANGE, vstring);
}
else SendClientMessage(playerid,COLOR_GREY, "You're not authorized to use this command.");
return 1;
}