Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new IdVeiculo[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- IdVeiculo[playerid] = INVALID_VEHICLE_ID;
- return 0x01;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- IdVeiculo[playerid] = vehicleid;
- if(IdVeiculo[playerid] != vehicleid) //Para nao criar Varios Timers ...
- {
- SetTimerEx("VerificarVeiculo",3000,false,"ii", vehicleid, playerid);
- }
- return 0x01;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- IdVeiculo[playerid] = INVALID_VEHICLE_ID;
- return 0x01;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- IdVeiculo[playerid] = INVALID_VEHICLE_ID;
- return 0x01;
- }
- forward VerificarVeiculo(vehicleid, playerid);
- public VerificarVeiculo(vehicleid, playerid)
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IdVeiculo[i] == IdVeiculo[playerid] && GetPlayerState(i) == PLAYER_STATE_DRIVER)
- {
- if(GetPlayerPing(playerid) < 910 && GetPlayerPing(i) < 910)
- {
- RemovePlayerFromVehicle(playerid);
- return 0x01;
- }
- else
- {
- SetTimerEx("VerificarVeiculo",1500,false,"ii", vehicleid, playerid);
- return 0x01;
- }
- }
- }
- }
- return 0x01;
- }
Advertisement
Add Comment
Please, Sign In to add comment