Hello, I have converted my server to 0.3c, and everything works perfect. But when i tried to convert old vehicle system to samp one, i have this problem :
Код:
forward OtherTimer();
public OtherTimer()
{
new sendername[MAX_PLAYER_NAME];
new sendername2[MAX_PLAYER_NAME];
new string[128];
foreach (Player,i)
{
if(GetPVarInt(i, "PlayerLogged") == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
for(new h = 0; h < sizeof(FamilyInfo); h++)
{
if(PlayerToPoint(1.0, i, FamilyInfo[h][FamilyExit][0], FamilyInfo[h][FamilyExit][1], FamilyInfo[h][FamilyExit][2]))
{
if(GetPlayerVirtualWorld(i) == h)
{
SetPlayerVirtualWorld(i,0);
SetPlayerInterior(i,0);
DOO_SetPlayerPos(i,FamilyInfo[h][FamilySpawn][0],FamilyInfo[h][FamilySpawn][1],FamilyInfo[h][FamilySpawn][2]);
}
}
}
if(GetPlayerWeapon(i) > 0)
{
if(GetPlayerState(i) != PLAYER_STATE_DRIVER)
{
if(Weapons[i][GetPlayerWeapon(i)] == 0)
{
Weapons[i][GetPlayerWeapon(i)]=1;
RemovePlayerWeaponEx(i, GetPlayerWeapon(i));
}
}
}
foreach (Player,q)
{
switch (PlayerInfo[q][pMaskUse])
{
case 0:
{
ShowPlayerNameTagForPlayerEx(i,q,1);
}
case 1:
{
ShowPlayerNameTagForPlayerEx(i,q,0);
format(string, 128, "Stranger_%d", PlayerInfo[q][pRandMask]);
SetPlayerChatBubble(q, string, COLOR_WHITE, 10.0, 1000);
}
}
}
if(PlayerInfo[i][pBreakingIn] == 1)
{
if(GetPlayerState(i) == PLAYER_STATE_ONFOOT)
{
if(PlayerInfo[i][pBreakingInTime] > 0)
{
new h = PlayerInfo[i][pBreakingInID];
if (PlayerToPoint(3.0, i,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
{
PlayerInfo[i][pBreakingInTime] --;
format(string, 128, "%d", PlayerInfo[i][pBreakingInTime]);
GameTextForPlayer(i, string, 4000, 3);
}
else
{
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakin] = 0;
PlayerInfo[i][pBreakingIn] = 0;
PlayerInfo[i][pBreakingInTime] = 0;
PlayerInfo[i][pBreakingInID] = 255;
}
}
else if(PlayerInfo[i][pBreakingInTime] == 0)
{
PlayerInfo[i][pBreakingIn] = 0;
new RandomStart;
RandomStart = random(4);
if(PlayerInfo[i][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", PlayerInfo[i][pRandMask]); }
switch(RandomStart)
{
case 0,1:
{
HouseInfo[PlayerInfo[i][pBreakingInID]][hLock] = 0;
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakTime] = 4;
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakin] = 0;
format(string, 128, "* House lock has been opened (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[i][pBreakingInID] = 255;
PlayerInfo[i][pBreakAllow] = 2;
}
case 2,3:
{
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakTime] = 4;
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakin] = 0;
format(string, 128, "* House lock did not budge (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[i][pBreakingInID] = 255;
PlayerInfo[i][pBreakAllow] = 2;
}
}
}
}
else
{
HouseInfo[PlayerInfo[i][pBreakingInID]][hBreakin] = 0;
PlayerInfo[i][pBreakingIn] = 0;
PlayerInfo[i][pBreakingInTime] = 0;
PlayerInfo[i][pBreakingInID] = 255;
}
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new idcar = GetPlayerVehicleID(i);
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo2[HotWire][i] == 1 && PlayerInfo2[HotWireTime][i] > 0)
{
PlayerInfo2[HotWireTime][i] --;
format(string, 128, "%d", PlayerInfo2[HotWireTime][i]);
GameTextForPlayer(i, string, 4000, 3);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(i, X, Y, Z);
switch(GetPVarInt(i, "VehON"))
{
case 0:
{
CarLights(idcar,2);
SetPVarInt(i, "VehON", 1);
PlaySoundInArea(1147,X,Y,Z,20.0);
}
case 1:
{
CarLights(idcar,1);
SetPVarInt(i, "VehON", 0);
PlaySoundInArea(1147,X,Y,Z,20.0);
}
}
}
else if(PlayerInfo2[HotWire][i] == 1 && PlayerInfo2[HotWireTime][i] == 0)
{
PlayerInfo2[HotWire][i] = 0;
new RandomStart;
RandomStart = random(4);
GiveNameSpace(sendername);
if(PlayerInfo[i][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", PlayerInfo[i][pRandMask]); }
switch(RandomStart)
{
case 0,1,2:
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(idcar,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx{idcar,1,lights,alarm,doors,bonnet,boot,objective);
format(string, 128, "* Vehicle hotwired (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
case 3:
{
SendClientMessage(i,COLOR_LIGHTRED,"Vehicle did not hotwire.");
format(string, 128, "* Vehicle did not hotwire (( %s ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
}
}
if(PlayerInfo2[InTaxi][i] == 1)
{
GetPlayerName(PlayerInfo2[DrivingTaxi][i], sendername2, sizeof(sendername2));
GiveNameSpace(sendername);
GiveNameSpace(sendername2);
if(PlayerInfo2[DrivingTaxi][i] != SCRIPT_PLAYERS && IsPlayerConnected(PlayerInfo2[DrivingTaxi][i]))
{
if(GetPlayerState(i) == PLAYER_STATE_PASSENGER && GetPlayerVehicleID(i) >= 61 && GetPlayerVehicleID(i) <= 70)
{
if(GetPlayerState(PlayerInfo2[DrivingTaxi][i]) == PLAYER_STATE_DRIVER && GetPlayerVehicleID(PlayerInfo2[DrivingTaxi][i]) == GetPlayerVehicleID(i))
{
if(GetPlayerPCash(i) > PlayerInfo2[TaxiEarn][i])
{
if(PlayerInfo2[EarnTime][i] <= 15)
{
PlayerInfo2[EarnTime][i]++;
format(string, 128, "~r~%d ~w~| ~g~$%d", PlayerInfo2[EarnTime][i], PlayerInfo2[TaxiEarn][i]);
GameTextForPlayer(i, string, 4000, 3);
GameTextForPlayer(PlayerInfo2[DrivingTaxi][i], string, 4000, 3);
}
else if(PlayerInfo2[EarnTime][i] >= 16)
{
PlayerInfo2[EarnTime][i] = 0;
PlayerInfo2[TaxiEarn][i] += 15;
format(string, 128, "~r~%d ~w~| ~g~$%d", PlayerInfo2[EarnTime][i], PlayerInfo2[TaxiEarn][i]);
GameTextForPlayer(i, string, 4000, 3);
GameTextForPlayer(PlayerInfo2[DrivingTaxi][i], string, 4000, 3);
}
}
else
{// Code if you cannot afford the rest of the fare
format(string, 128, "%s left the taxi because he couldnt afford anymore time.", sendername);
SendClientMessage(PlayerInfo2[DrivingTaxi][i],COLOR_WHITE,string);
RemovePlayerFromVehicle(i);
if(GetPlayerPCash(i) <= 15)
{
PlayerInfo2[TaxiEarn][i] = 15;
PlayerInfo2[InTaxi][i] = 0;
PlayerInfo2[DrivingTaxi][i] = SCRIPT_PLAYERS;
PlayerInfo2[EarnTime][i] = 0;
}
}
}
else
{// Remove if Driver isnt in the vehicle your in.
RemovePlayerFromVehicle(i);
PlayerInfo2[TaxiEarn][i] = 15;
PlayerInfo2[InTaxi][i] = 0;
PlayerInfo2[DrivingTaxi][i] = SCRIPT_PLAYERS;
PlayerInfo2[EarnTime][i] = 0;
}
}
else
{// Code if your not inside Passenger and inside a Taxi.
if(PlayerInfo[i][pConnectTime] >= 8)
{
format(string, 128, "You paid %s $%d for the amount of fare you owned him.", sendername2, PlayerInfo2[TaxiEarn][i]);
SendClientMessage(i,COLOR_WHITE,string);
format(string, 128, "%s paid you $%d.", sendername, PlayerInfo2[TaxiEarn][i]);
SendClientMessage(PlayerInfo2[DrivingTaxi][i],COLOR_WHITE,string);
GivePlayerPCash(PlayerInfo2[DrivingTaxi][i],PlayerInfo2[TaxiEarn][i]);
GivePlayerPCash(i,-PlayerInfo2[TaxiEarn][i]);
}
PlayerInfo2[TaxiEarn][i] = 15;
PlayerInfo2[InTaxi][i] = 0;
PlayerInfo2[DrivingTaxi][i] = SCRIPT_PLAYERS;
PlayerInfo2[EarnTime][i] = 0;
}
}
else
{
if(GetPlayerState(i) == PLAYER_STATE_PASSENGER && GetPlayerVehicleID(i) >= 61 && GetPlayerVehicleID(i) <= 70)
{
RemovePlayerFromVehicle(i);
PlayerInfo2[TaxiEarn][i] = 15;
PlayerInfo2[InTaxi][i] = 0;
PlayerInfo2[DrivingTaxi][i] = SCRIPT_PLAYERS;
PlayerInfo2[EarnTime][i] = 0;
}
}
}
if(PlayerInfo[i][pPizzaTime] > 0 && PlayerInfo2[pizzajob][i] == 1)
{
PlayerInfo[i][pPizzaTime]--;
format(string, 128, "%d", PlayerInfo[i][pPizzaTime]);
GameTextForPlayer(i, string, 4000, 6);
if(PlayerInfo[i][pPizzaTime] == 0 && PlayerInfo2[pizzajob][i] == 1)
{
SendClientMessage(i,COLOR_LIGHTRED,"[FAILED]: The pizza was too cold.");
PlayerInfo2[pizzajob][i] = 0;
SetPVarInt(i, "PlayerCheckpointStatus", CHECKPOINT_NONE);
DisablePlayerCheckpoint(i);
}
}
if(PlayerInfo[i][pJailTime] > 0)
{
PlayerInfo[i][pJailTime]--;
if(PlayerInfo[i][pJailTime] == 0)
{
PlayerInfo[i][pJailed] = 0;
DOO_SetPlayerPos(i, 1550.5609,-1674.4252,15.4549);
SetPlayerInterior(i,0);
SendClientMessage(i, COLOR_GRAD1," You have paid Your debt to society.");
GameTextForPlayer(i, "~g~Freedom~n~~w~Try to be a better citizen", 5000, 1);
TogglePlayerControllableEx(i,true);
SetPlayerVirtualWorld(i,0);
PlayerInfo2[Mute][i] = 0;
}
}
if(PlayerInfo[i][pJailTime] == 0 && PlayerInfo[i][pJailed] > 0)
{
PlayerInfo[i][pJailed] = 0;
DOO_SetPlayerPos(i, 1550.5609,-1674.4252,15.4549);
SetPlayerInterior(i,0);
SendClientMessage(i, COLOR_GRAD1," You have paid Your debt to society.");
GameTextForPlayer(i, "~g~Freedom~n~~w~Try to be a better citizen", 5000, 1);
TogglePlayerControllableEx(i,true);
SetPlayerVirtualWorld(i,0);
PlayerInfo2[Mute][i] = 0;
}
if(PlayerInfo2[PlayerCuffedTime][i] > 0 && PlayerInfo2[PlayerCuffed][i] == 2)
{
PlayerInfo2[PlayerCuffedTime][i] -= 1;
if(PlayerInfo2[PlayerCuffedTime][i] == 0 && PlayerInfo2[PlayerCuffed][i] == 2)
{
PlayerInfo2[PlayerCuffed][i] = 0;
TogglePlayerControllableEx(i,true);
}
}
if (PlayerInfo2[DragOff][i] != SCRIPT_PLAYERS)
{
new virtoff = GetPlayerVirtualWorld(PlayerInfo2[DragOff][i]);
SetPlayerVirtualWorld(i,virtoff);
new intoff = GetPlayerInterior(PlayerInfo2[DragOff][i]);
SetPlayerInterior(i,intoff);
new Float:x,Float:y,Float:z;
GetPlayerPos(PlayerInfo2[DragOff][i], x, y, z);
DOO_SetPlayerPos(i,x+1,y,z);
}
if(PlayerInfo[i][pJailTime] == 0)
{
if(PlayerInfo[i][pConnectTime] >= 0) { PlayerInfo[i][pPayCheck] += 1; }
}
if(PlayerInfo[i][pWeeder] > 0) { PlayerInfo[i][pWeeder] --; }
if(PlayerInfo2[JobDelay][i] > 0) { PlayerInfo2[JobDelay][i] --; }
if(PlayerInfo2[ReduceTime][i] > 0) { PlayerInfo2[ReduceTime][i] --; }
if(PlayerInfo2[JustReported][i] > 0) { PlayerInfo2[JustReported][i] --; }
if(PlayerInfo[i][pBenchPressTime] > 0) { PlayerInfo[i][pBenchPressTime] --; }
if(PlayerInfo2[FishDelay][i] > 0) { PlayerInfo2[FishDelay][i] --; }
}
}
return 1;
}
As I see, the problem is that this function does not allow the server to work on all of the cars spawned, how can i fix this ?