Help with Admin Vehicle.
#1

hello, i've made a command /aveh whihc spawn vehicle on for admins.
but when other player enters it it doesnt remove him from vehicle. i made this using foreach please help me

My Code.

OnTop

Quote:

#define MAX_ADMIN_VEHICLES 1000
new Iterator:AdminVeh<MAX_ADMIN_VEHICLES>;

Command /aveh

Quote:

COMMAND:aveh(playerid, params[])
{
return cmd_avehicle(playerid, params);
}
COMMAND:avehicle(playerid, params[])
{
new Vehicle[50],string[128], angle;

if(PlayerInfo[playerid][pAdminlevel] < 1)
{
SendClientMessage(playerid, COLOR_ERROR, ""ERROR_MSG"");
return 1;
}
if(sscanf(params, "s", Vehicle))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /veh (Vehicle)");
return 1;
}

new veh = GetVehicleModelIDFromName(Vehicle);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);

if(Iter_Count(AdminVeh)== MAX_ADMIN_VEHICLES)return 1;

Iter_Add(AdminVeh,CreateVehicle(veh, X+3, Y, Z, angle, -1, -1, -1));

format(string, sizeof(string), "You have Spawned a %s. ID: %i. ", VehicleNames[veh - 400], veh);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);

if(veh < 400 || veh > 611)
{
SendClientMessage(playerid, COLOR_ERROR, "Invalid Vehicle ID / Name.");
return 1;
}
return 1;
}

OnPlayerStateChange
Quote:

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new vehicleid = GetPlayerVehicleID(playerid);

foreach(new VehID:AdminVeh)
{
if(VehID == vehicleid)
{
if(PlayerInfo[playerid][pAdminlevel] < 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ERROR, "This Is An Admin Vehicle.");
GameTextForPlayer(playerid, "Ejected: Admin Vehicle", 3000, 3);
}
}
}
}
return 1;
}

Please Help me.
Reply


Messages In This Thread
Help with Admin Vehicle. - by danish007 - 22.12.2014, 18:09
Re: Help with Admin Vehicle. - by Quickie - 23.12.2014, 00:20
Re: Help with Admin Vehicle. - by danish007 - 23.12.2014, 09:18
Re: Help with Admin Vehicle. - by danish007 - 24.12.2014, 18:03
Re: Help with Admin Vehicle. - by Clad - 24.12.2014, 18:08
Re: Help with Admin Vehicle. - by Biess - 24.12.2014, 19:05
Re: Help with Admin Vehicle. - by danish007 - 24.12.2014, 20:35
Re: Help with Admin Vehicle. - by danish007 - 25.12.2014, 17:57
Re: Help with Admin Vehicle. - by dominik523 - 25.12.2014, 18:04
Re: Help with Admin Vehicle. - by danish007 - 25.12.2014, 20:46

Forum Jump:


Users browsing this thread: 5 Guest(s)