29.03.2011, 20:30
hello all i have made lock unlock commands!
now what i need i done from it it's all work no problems but when i use lock command i tell me
Vehicle Locked But other players can steal it from me and enter it like what they want how i can let them no enter my car while im locked it! thanks hope you will help me guys!
pawn Код:
if(strcmp(cmd, "/lock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_RED,"You can only lock the doors as the driver.");
return 1;
}
lockedCar[GetPlayerVehicleID(playerid)]=1;
new i;
for (i=0;i<MAX_PLAYERS;i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
}
SendClientMessage(playerid, COLOR_YELLOW, "Vehicle locked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1056,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not in a vehicle!");
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/unlock", true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new State=GetPlayerState(playerid);
if (State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_RED,"You can only unlock the doors as the driver.");
return 1;
}
new i;
lockedCar[GetPlayerVehicleID(playerid)]=0;
for (i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
}
SendClientMessage(playerid, COLOR_YELLOW, "Vehicle unlocked!");
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not in a vehicle!");
}
return 1;
}
Vehicle Locked But other players can steal it from me and enter it like what they want how i can let them no enter my car while im locked it! thanks hope you will help me guys!