23.02.2010, 20:03
I need help with my /lock and /unlock....
how could i make it so it detects to see if a player used the /lock command? instead of just saying "vehicle unlocked" every time a player gets out of the vehicle.
Here are my /lock and /unlock commands
Now, i need a auto unlock when a player leaves the car, so i did this but this does not detect it...
how could i make it so it detects to see if a player used the /lock command? instead of just saying "vehicle unlocked" every time a player gets out of the vehicle.
Here are my /lock and /unlock commands
Код:
if (strcmp(cmdtext, "/lock", true)==0) { if(IsPlayerInAnyVehicle(playerid)) { new State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,0xFFFF00AA,"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); } } SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!"); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid,pX,pY,pZ); PlayerPlaySound(playerid,1056,pX,pY,pZ); locked[playerid][GetPlayerVehicleID(playerid)] = 1; } else { SendClientMessage(playerid, 0xFFFF00AA, "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,0xFFFF00AA,"You can only lock the doors as the driver."); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0); } SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!"); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid,pX,pY,pZ); PlayerPlaySound(playerid,1057,pX,pY,pZ); locked[playerid][GetPlayerVehicleID(playerid)] = 0; } else { SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!"); } return 1; }
Код:
public OnPlayerExitVehicle(playerid, vehicleid) { new i; for(i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0); } SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!"); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid,pX,pY,pZ); PlayerPlaySound(playerid,1057,pX,pY,pZ); locked[playerid][GetPlayerVehicleID(playerid)] = 0; } return 1; }