19.08.2013, 18:55
(
Последний раз редактировалось Ananisiki; 15.12.2013 в 19:03.
)
^^^^^^^^
defining new WHATEVER[NUMBER_OF_SLOTS] //MAX_VEHICLES i think it is 2000 storing variables in the array: WHATEVER[0] = CreateVehicle(..); //THE ARRAY SLOT 0 WHATEVER[1] = CreateVehicle(..); //THE ARRAY SLOT 0 WHATEVER[2] = CreateVehicle(..); //THE ARRAY SLOT 0 //note: do not cross the limit when you storing the data (the array id must be lover for 1 of the number of slots in the array), in this case the "NUMBER_OF_SLOTS" is 3 - 3 slots; checking: if(GetPlayerVehicleID(playerid) == WHATEVER[THE_ARRAY_ID_TO_CHECK_THE_DATA_THAT-IS_STORED_IN_THE_ARRAY_ID])
#define MAX_ADMIN_VEHICLES 3
new AdminCar[MAX_ADMIN_VEHICLES];
public OnFilterScriptInit()
{
AdminCar[0] = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
AdminCar[1] = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
AdminCar[2] = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && IsAdminVehicle(GetPlayerVehicleID(playerid)))
{
if(!IsCnRAdmin(playerid))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x281aeb, "This vehicle doesn't belong to you.");
}
}
return 1;
}
IsAdminVehicle(vehicleid)
{
for(new i; i < MAX_ADMIN_VEHICLES; i++)
{
if(vehicleid == AdminCar[i])
{
return true;
}
}
return false;
}
#include <a_samp>
new AdminCar[3];
enum PlayerInfo
{
Admin
}
new PlayerData[MAX_PLAYERS][PlayerInfo];
public OnFilterScriptInit()
{
AdminCar[0] = CreateVehicle(...);
AdminCar[1] = CreateVehicle(...);
AdminCar[2] = CreateVehicle(...);
return 1;
}
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
if(PlayerData[playerid][Admin] == 0)
{
for(new i; i < sizeof(AdminCar); i++)
{
if(GetPlayerVehicleID(playerid) == i)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x281aeb, "This vehicle doesn't belong to ");
}
}
}
return 1;
}