18.08.2012, 07:02
OK,so,basically I've got timed out from my server(I was in a car,with my friend as passenger),and by reflex(he plays BF3) he pressed F1 to switch to driver's seat,so I got the idea to script it,yet,obviusly,as F1 is an assigned key in SAMP,I used SPACE.So when a player wich is passenger in a car with no driver presses SPACE,he should be moved to driver's seat,yet,even if the code returns no errors,it doesn't work:
So,what's worng?Thanks in advance.
pawn Код:
new vehicleid=GetPlayerVehicleID(playerid);
if(newkeys & KEY_JUMP)
{
if(GetPVarInt(playerid,"Adminlevel") != 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGER)
{
new OK=1;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i)==GetPlayerVehicleID(playerid))
{
if(GetPlayerState(i)==PLAYER_STATE_DRIVER)
{
OK=0;
break;
}
}
}
}
if(OK==1)
{
PutPlayerInVehicle(playerid,vehicleid,0);
SendClientMessage(playerid,COLOR_GREEN,"Succesfully transfered to driver's seat!");
}
else
{
SendClientMessage(playerid,COLOR_RED,"This vehicle is ocuppied(it has a driver)!");
}
}
}
}
}