[TUT] Lock vehicles by name(s)
#1

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{

    // ONE NAME ONLY
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(forplayerid, playername, sizeof(playername));

       if(vehicleid >= 000){ // What vehicleid (ONE VEHICLE)
    if(strfind(playername, "Mike_Garber", true) == -1){ // Type whatever name you want to have access
    SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1); // If It's not that name, It will lock
    }else{
    SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0); // else, (if he got the correct name) unlock.
    }
    }


// SEVERAL NAMES
 // new playername[MAX_PLAYER_NAME]; // RE-ENABLE IF YOU DON'T USE THE CODE ABOVE
 // GetPlayerName(forplayerid, playername, sizeof(playername)); // RE-ENABLE IF YOU DONT USE THE CODE ABOVE

    if(vehicleid >= 000 && vehicleid <= 001){ // Vehicle ID between the first and the last value
    if(strfind(playername, "Mike_Garber", true) == -1 || strfind(playername, "James_Smith", true) == -1){ // Type whatever names you want to have access
    SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1); // If It's not that name, It will lock
    }else{
    SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0); // else, (if he got the correct name) unlock.
    }
    }
}
Easy, fast and less code then the other thread.
You have to intendent the code as I modified it on the forums xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)