if (strcmp(cmdtext, "/locker", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFF004040,"You can only lock the doors as the driver.");
return 1;
}
new i;
for(i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
new lock;
for(lock=0;i<MAX_PLAYERS;lock++)
if(lock == 1)
{
SendClientMessage(playerid, 0xFF004040,"Tu jau esi aizsleedzis kaadu citu transporta liidzekli.");
lock == 1;
return 1;
}
if(lock == 0)
{
SendClientMessage(playerid, 0x33AA33AA,"Transporaliidzeklis aizsleegts.");
}
SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
}
return 1;
}
if (strcmp(cmdtext, "/unlock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFF004040,"You can only unlock the doors as the driver.");
return 1;
}
new i;
for(i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
}
SendClientMessage(playerid, 0x33AA33AA, "Vehicle unlocked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
}
return 1;
}
return 0;
}
}
CMD:vlock(playerid, params[])
{
new oldcar = LastCar[playerid];
new Float:cX, Float:cY, Float:cZ;
GetVehiclePos(oldcar, cX, cY, cZ);
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(oldcar, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerInRangeOfPoint(playerid, 4, cX, cY, cZ))
{
SendClientMessage(playerid,red,"You're not in range/in the Vehicle you last drove!");
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 4, cX, cY, cZ))
{
if(doors != 1)
{
doors = 1;
SetVehicleParamsEx(oldcar,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, " You've locked the vehicle!");
return 1;
}
else
{
doors = 0;
SetVehicleParamsEx(oldcar,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, " You've unlocked the vehicle!");
return 1;
}
}
return doors;
}
public OnPlayerEnterVehicle(playerid, vehicleid)
{
LastCar[playerid] = vehicleid;
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
LastCar[playerid] = vehicleid;
return 1;
}
if (strcmp(cmdtext, "/locker", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFF004040,"You can only lock the doors as the driver.");
return 1;
}
new i;
for(i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
new lock;
for(lock=0;i<MAX_PLAYERS;lock++)
if(lock == 1)
{
SendClientMessage(playerid, 0xFF004040,"Tu jau esi aizsleedzis kaadu citu transporta liidzekli.");
lock == 1;
return 1;
}
if(lock == 0)
{
SendClientMessage(playerid, 0x33AA33AA,"Transporaliidzeklis aizsleegts.");
}
SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
}
return 1;
}
if (strcmp(cmdtext, "/unlock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,0xFF004040,"You can only unlock the doors as the driver.");
return 1;
}
new i;
for(i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
}
SendClientMessage(playerid, 0x33AA33AA, "Vehicle unlocked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
}
return 0;
}
return 1;
}
Maybe try this?
pawn Код:
If this worked tell me |