SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/01/2012, 04:58 AM   #1
Nuke547
Big Clucker
 
Join Date: Dec 2011
Posts: 172
Reputation: 16
Default Lock Command Doesnt Work?

This is the command. It only shows that it is locked for you, but not anybody else.

PHP Code:
command(lockplayeridparams[])
{
    new 
string[256];
    if(
Player[playerid][PlayerCarModel] > && IsPlayerInRangeOfVehicle(playeridPlayer[playerid][CarLinkID], 4))
    {
           if(
Player[playerid][CarLinkID] > 0)
           {
               if(
Player[playerid][LockedCar] == 0)
               {
                   
Player[playerid][LockedCar] = 1;
                   
format(stringsizeof(string), "* %s takes out their keys and locks their car."GetName(playerid));
                   
NearByMessage(playeridNICESKYstring);
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
== playerid)
                    {
                        
SetVehicleParamsForPlayer(Player[playerid][CarLinkID], i01);
                    }
                }
                return 
1;
            }
            else
            {
                
format(stringsizeof(string), "* %s takes out their keys and unlocks their car."GetName(playerid));
                   
NearByMessage(playeridNICESKYstring);
                
Player[playerid][LockedCar] = 0;
                for(new 
0MAX_PLAYERSi++)
                {
                    
SetVehicleParamsForPlayer(Player[playerid][CarLinkID], i00);
                }
                return 
1;
            }

        }
    }

Nuke547 is offline   Reply With Quote
Old 29/01/2012, 05:50 AM   #2
mineralo
Gangsta
 
mineralo's Avatar
 
Join Date: Oct 2011
Posts: 552
Reputation: 9
Default Re: Lock Command Doesnt Work?

it should work, you maybe forgot to write stuff OnPlayerEnterVehicle
write something like this:
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(ispassenger == 0)
    {
if locked
{
GetPlayerPos(playerid,Float:LocX,Float:LocY,Float:LocZ);
            SetPlayerPos(playerid,Float:LocX,Float:LocY,Float:LocZ);
            SendClientMessage(playerid,COLOR_GREY,"( ! ) This vehicle is locked by the owner !");
}
}
}return 1;
}
mineralo is offline   Reply With Quote
Reply

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
Command doesnt work as it should :/ HondaCBR Scripting Help 0 03/12/2011 03:15 PM
why the command doesnt work ? kingforyou Help Archive 0 13/03/2010 08:38 AM
[HELP]My command doesnt work Lilcuete Help Archive 6 06/12/2009 03:30 PM
Little command doesnt work Striker_Moe Help Archive 6 06/09/2009 09:51 AM
[HELP] Why this command doesnt work? Spatman Help Archive 18 14/08/2009 01:32 PM


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


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