SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 23/11/2012, 06:15 PM   #1
Bug.
Big Clucker
 
Join Date: Aug 2012
Posts: 185
Reputation: 2
Default Vehicle key............

How to add to here vehicle key
http://forum.sa-mp.com/showthread.php?t=273088

with spawn pos and more like vehicle color,lock.....
__________________
( . Y . )
Bug. is offline   Reply With Quote
Old 23/11/2012, 06:17 PM   #2
Hugoca
Big Clucker
 
Join Date: Sep 2012
Posts: 102
Reputation: 0
Default Re: Vehicle key............

pawn Code:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pKey
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Code:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Key",PlayerInfo[playerid][pKey]);
    return 1;
}
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Key",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Key",PlayerInfo[playerid][pKey]);
    INI_Close(File);
    return 1;
}
new car[10];
And add under OnGameModeInit
car[0] = AddStaticVehicle(vehicleid, posx, posy, posz, color1, color2);
And under OnPlayerStateChange add:
pawn Code:
if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == car[0])
        {
                new Float:shealth;
                new Float:slx, Float:sly, Float:slz;
                GetPlayerHealth(playerid, shealth);
                SetPlayerHealth(playerid, shealth-20);
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz+5);
                PlayerPlaySound(playerid, 1130, slx, sly, slz+5);
                SendClientMessage(playerid,COLOR_RED, "You can't use this car!");
        }
    }
Hugoca is offline   Reply With Quote
Old 23/11/2012, 09:41 PM   #3
Bug.
Big Clucker
 
Join Date: Aug 2012
Posts: 185
Reputation: 2
Default Re: Vehicle key............

who can give me a another option, i want add to this /park, command and lock,spawn,despawn,and more....
__________________
( . Y . )
Bug. is offline   Reply With Quote
Old 23/11/2012, 09:44 PM   #4
Bug.
Big Clucker
 
Join Date: Aug 2012
Posts: 185
Reputation: 2
Default Re: Vehicle key............

is a own vehicle!, and all can drive in that vehicle if tye vehicle opened!!!!
__________________
( . Y . )
Bug. is offline   Reply With Quote
Old 24/11/2012, 10:03 AM   #5
Bug.
Big Clucker
 
Join Date: Aug 2012
Posts: 185
Reputation: 2
Default Re: Vehicle key............

help me i want to make a own vehicle.... Like in PR-RP.com
__________________
( . Y . )
Bug. is offline   Reply With Quote
Old 24/11/2012, 10:19 AM   #6
Faisal_khan
High-roller
 
Faisal_khan's Avatar
 
Join Date: Feb 2012
Location: Ireland and India
Posts: 1,826
Reputation: 208
Default Re: Vehicle key............

Now since you have broken the forum rules, (You may only bump your thread after 48 hours has passed since the last reply.) this topic will not help you anymore. Please make a new one.
__________________
Not a SAMP Dev. anymore.
Faisal_khan 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
[FilterScript] GTA's Vehicle Spawns (1040 vehicle spawn locations) Slice Filterscripts 51 10/07/2019 07:41 AM
Angle Issues: Setting a attached object on a vehicle to face a vehicle Kar Scripting Help 2 11/07/2012 12:37 AM
[FilterScript] [FS] tAxI's Vehicle Streamer [v0.2] - add unlimited vehicle spawns and models!!! cptnsausage Filterscripts 205 31/07/2010 05:29 AM


All times are GMT. The time now is 04:58 PM.


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