Lock/unlock Help
#1

I got this codes:

Код:
if(!strcmp(cmdtext,"/lock",true,5)) {
 	  new carid;
  		if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER) {
  		  GameTextForPlayer(playerid,"~r~LOCKED !",1000,1);
   		carid=GetPlayerVehicleID(playerid);
   		new i;
   		for (i=0;i<MAX_PLAYERS;i++){
    		if (i!=playerid) SetVehicleParamsForPlayer(carid,i,0,1);
  		}
  		return 1;
 		}
 		else
 		{
 		  SendClientMessage(playerid, COLOR_YELLOW, "ERROR : You need to be in a vehicle that you want to be unlocked.");
 		  return 1;
		}

 	}

 	if(!strcmp(cmdtext,"/unlock",true,7)) {
 	  new carid;
  		if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER) {
   		carid=GetPlayerVehicleID(playerid);
			GameTextForPlayer(playerid,"~g~UNLOCKED !",1000,1);
   		new i;
   		for (i=0;i<MAX_PLAYERS;i++){
    		if (i!=playerid) SetVehicleParamsForPlayer(carid,i,0,0);
  		}
  		return 1;
 		}
 		else
 		{
 		  SendClientMessage(playerid, COLOR_YELLOW, "ERROR : You need to be in a vehicle as a driver that you want to be unlocked.");
 		  return 1;
		}
 	}
But i do want to be able to lock/unlock Taxi and Scooters... what do i do?

Srry for my english
Reply
#2

change
pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
to
pawn Код:
if (IsPlayerInVehicle(playerid, vehicleid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
And vehicleid is the vehicles id, not the model id
Reply
#3

and if i want to add more vehicle id what do i do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)