Some problems -
sKenzi1996 - 12.02.2017
Hello everyone, i just made a DMV system and didn't work properly.
1. I want to put a restriction when a player wants to get in the exam car, but i can't figure it out!
Код:
if(vehicleid == examen[0] || vehicleid == examen[1] || vehicleid == examen[2] || vehicleid == examen[3] || vehicleid == examen[4])
{
SendClientMessage(playerid, -1, "INFO: Those cars can be used only in exam");
RemovePlayerFromVehicle(playerid); // This is not working.
}
2. I want to put a restriction to [/examen] command. When IsPlayerInAnyVehicle, don't let him use the command.
Код:
CMD:examen(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 1312.2740, -1387.2186, 13.5491))
{
if(InExam[playerid] == 1) return SendClientMessage(playerid, -1, "INFO: You are already in the exam");
for(new v = 0; v < 5; v++)
{
PutPlayerInVehicle(playerid, examen[v], 0);
}
SendClientMessage(playerid, -1, "INFO: Follow the checkpoints to finish the exam");
InExam[playerid] = 1;
}
else
{
SendClientMessage(playerid, -1, "INFO: You have to be in front of the DMV");
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, 0x00FF00AA, "You are in a vehicle.");
// what command needs to be here?!
}
}
return 1;
}
Thank you!
Re: Some problems -
Dayrion - 12.02.2017
1. Put the full code and not a part.
2.
PHP код:
CMD:examen(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
return 1;
if(!IsPlayerInRangeOfPoint(playerid, 8.0, 1312.2740, -1387.2186, 13.5491))
return SendClientMessage(playerid, -1, "INFO: You have to be in front of the DMV");
if(InExam[playerid]) return SendClientMessage(playerid, -1, "INFO: You are already in the exam");
for(new v = 0; v < 5; v++)
{
PutPlayerInVehicle(playerid, examen[v], 0); // What the fuck is this? You put 5 times the player in differents vehicle?
}
SendClientMessage(playerid, -1, "INFO: Follow the checkpoints to finish the exam");
InExam[playerid] = 1;
return 1;
}
Re: Some problems -
sKenzi1996 - 12.02.2017
1.
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == examen[0] || vehicleid == examen[1] || vehicleid == examen[2] || vehicleid == examen[3] || vehicleid == examen[4])
{
SendClientMessage(playerid, -1, "INFO: Those cars can be used only in exam");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
Full code.
2. Nope, i have 4 cars, if 1 of them is busy, remains 3. So, put that player in different car. You have the answer?
Re: Some problems -
Dayrion - 12.02.2017
1.
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new vehicleid = GetPlayerVehicleID(playerid);
for(new v; v < 5; v++)
{
if(vehicleid == examen[v])
{
RemovePlayerFromVehicle(playerid);
return 1;
}
}
}
return 1;
}
2. Actually, you will put the player in the car examen[0] then examen[1], etc..
Re: Some problems -
sKenzi1996 - 12.02.2017
1. Thanks for this! It works, but i have a little problem. When the player get in and get out from vehicle those checkpoints still appears. What i have to do?
2. What's the finally answer for my problem?

) I want a restriction for those players who use command [/examen] when they ar in differents cars.
Re: Some problems -
Dayrion - 12.02.2017
1. You have to disable the checkpoint?
https://sampwiki.blast.hk/wiki/DisablePlayerCheckpoint
2.
Might work:
PHP код:
new free;
foreach(new i : Player)
{
if(!IsPlayerInAnyVehicle(i))
continue;
if(GetPlayerVehicleID(i) == examen[free] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
free++;
}