SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 11/08/2011, 01:13 AM   #1
Rabbayazza
Big Clucker
 
Join Date: Jul 2008
Posts: 108
Reputation: 0
Default Lock a car and Lock Skin for specific player

Okay, say theres a player named "Robert" and we want to make a car that only "Robert" can drive, all others get a message saying this is roberts car, or a skin that only Robert can use, with others dying if they try to spawn as it. How do I do this?
Rabbayazza is offline  
Old 11/08/2011, 01:57 AM   #2
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,809
Reputation: 701
Default Re: Lock a car and Lock Skin for specific player

Go read the forum rules. Bumping your thread within 24 hours from the last post can result in an infraction!

You need to create a variable which saves the vehicle ID that only "Robert" can drive. You can use this callback to run a check to see if the vehicle ID matches the one which is restricted to "Robert." If it is, check the player's name and see if it matches "Robert's." If it does, then return 1 and leave it alone; otherwise you can send them a message and kick them from the vehicle using this function.
Scenario is offline  
Old 11/08/2011, 01:58 AM   #3
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,836
Reputation: 668
Default AW: Lock a car and Lock Skin for specific player

RemovePlayerFromVehicle wont work in OnPlayerEnterVehicle

Just use OnPlayerStateChange and the state PLAYER_STATE_DRIVER
Nero_3D is offline  
Old 11/08/2011, 02:02 AM   #4
Rabbayazza
Big Clucker
 
Join Date: Jul 2008
Posts: 108
Reputation: 0
Default Re: Lock a car and Lock Skin for specific player

... I don't understand what any of you just said.. I can't script anything myself.. help.
Rabbayazza is offline  
Old 11/08/2011, 02:02 AM   #5
SchurmanCQC
High-roller
 
SchurmanCQC's Avatar
 
Join Date: Oct 2010
Location: Ontario, Canada
Posts: 1,741
Reputation: 249
Default Re: AW: Lock a car and Lock Skin for specific player

Quote:
Originally Posted by Nero_3D View Post
RemovePlayerFromVehicle wont work in OnPlayerEnterVehicle

Just use OnPlayerStateChange and the state PLAYER_STATE_DRIVER
+rep, I was going to reply with this same message until I saw you posted it.
SchurmanCQC is offline  
Old 11/08/2011, 02:20 AM   #6
Rabbayazza
Big Clucker
 
Join Date: Jul 2008
Posts: 108
Reputation: 0
Default Re: Lock a car and Lock Skin for specific player

Someone teach me how to do this or give me a tutorial link.. I don't know how to do all these functions.
Rabbayazza is offline  
Old 11/08/2011, 02:43 AM   #7
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,809
Reputation: 701
Default Re: AW: Lock a car and Lock Skin for specific player

Quote:
Originally Posted by Nero_3D View Post
RemovePlayerFromVehicle wont work in OnPlayerEnterVehicle

Just use OnPlayerStateChange and the state PLAYER_STATE_DRIVER
Oh yeah... I forgot. Sorry about that!

EDIT: This code should work for you. There is a new variable at the top, learn where it goes.

pawn Code:
new iRVehicle; // This needs to be the vehicle ID of "Robert's" vehicle.

public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == iRVehicle))
        {
            new szName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, szName, sizeof(szName));
            if(!strcmp(szName, "Robert", false)) return 1;
            else RemovePlayerFromVehicle(playerid, GetPlayerVehicleID(playerid)), SendClientMessage(playerid, 0xFFFFFFFF, "GET THE FUCK OUT!!! THIS VEHICLE BELONGS TO ROBERT!!!");
        }
    }
    return 1;
}
Scenario is offline  
Old 11/08/2011, 02:47 AM   #8
Rabbayazza
Big Clucker
 
Join Date: Jul 2008
Posts: 108
Reputation: 0
Default Re: Lock a car and Lock Skin for specific player

So can someone teach me how to do this
Rabbayazza is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] Lock skin kenyas Help Archive 11 06/03/2010 10:47 PM
Lock Skin tiwk Help Archive 4 23/10/2009 08:04 PM
How to lock a car for everyone when a specific player is offline... introzen Help Archive 1 16/06/2009 11:05 PM


All times are GMT. The time now is 01:05 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.