SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 02/12/2009, 09:36 AM   #1
jamesbond007
Gangsta
 
jamesbond007's Avatar
 
Join Date: Oct 2009
Location: Canadia
Posts: 857
Reputation: 50
Default binding fix+nitro

how do i bind a key, lets say the number 2
to fix and add 10x nitro to my server?
jamesbond007 is offline  
Old 02/12/2009, 09:54 AM   #2
Cedimedi
Huge Clucker
 
Join Date: Jun 2009
Posts: 441
Reputation: 0
Default Re: binding fix+nitro

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_SUBMISSION)) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
    }


greetz
Cedimedi is offline  
Old 02/12/2009, 10:10 AM   #3
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,212
Reputation: 22
Default Re: binding fix+nitro

Don't forget to add
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0)
dice7 is offline  
Old 02/12/2009, 10:53 AM   #4
_Sami_
Big Clucker
 
Join Date: Nov 2009
Posts: 72
Reputation: 0
Default Re: binding fix+nitro

Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(adminlevel[playerid] < 1) return 0;
else
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be in a vehicle to type 2.");
else
if ((newkeys & KEY_SUBMISSION)) /// This will add 10x NOS to the car and repair it if player is in a car.

   AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  4086 = RepairVehicle(GetPlayerVehicleID(playerid));
	 SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);

   return 1;
}
C:\Documents and Settings\Administrator\Desktop\gamemodes\lvdm.pwn( 4086) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
_Sami_ is offline  
Old 02/12/2009, 11:11 AM   #5
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,212
Reputation: 22
Default Re: binding fix+nitro

This is loose indentation
pawn Code:
if(a< something)
    {
       do something else
   do something else part2
}

This is correct indentation
pawn Code:
if(a< something)
{
   do something else
   do something else part2
}
dice7 is offline  
Old 02/12/2009, 11:38 AM   #6
_Sami_
Big Clucker
 
Join Date: Nov 2009
Posts: 72
Reputation: 0
Default Re: binding fix+nitro

Quote:
Originally Posted by dice7
This is loose indentation
pawn Code:
if(a< something)
    {
       do something else
   do something else part2
}

This is correct indentation
pawn Code:
if(a< something)
{
   do something else
   do something else part2
}
i doesnt understood can u set it as a correct indentation
_Sami_ is offline  
Old 02/12/2009, 12:10 PM   #7
Djiango
Huge Clucker
 
Join Date: Feb 2008
Posts: 222
Reputation: 0
Default Re: binding fix+nitro

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
        if(adminlevel[playerid] < 1) return 1;
        else if(!IsPlayerInAnyVehicle(playerid)) return 1;
        else
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
            return 1;
        }
    }
    return 1;
}

About Correct Indention!
http://forum.sa-mp.com/index.php?topic=61893.0
Djiango is offline  
Old 02/12/2009, 12:46 PM   #8
Cedimedi
Huge Clucker
 
Join Date: Jun 2009
Posts: 441
Reputation: 0
Default Re: binding fix+nitro

Quote:
Originally Posted by dice7
Don't forget to add
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0)
pawn Code:
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
makes no sense, RepairVehicle fix the health and the damage.

Cedimedi is offline  
Old 02/12/2009, 07:54 PM   #9
_Sami_
Big Clucker
 
Join Date: Nov 2009
Posts: 72
Reputation: 0
Default Re: binding fix+nitro

Quote:
Originally Posted by |∞|-цппσĵσ-|∞|
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION) /// This will add 10x NOS to the car and repair it if player is in a car.
    {
        if(adminlevel[playerid] < 1) return 1;
        else if(!IsPlayerInAnyVehicle(playerid)) return 1;
        else
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
            return 1;
        }
    }
    return 1;
}

About Correct Indention!
http://forum.sa-mp.com/index.php?topic=61893.0
thanks for giving a site this link
_Sami_ 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
binding IPs potato Server Support 3 16/06/2010 11:57 AM
Binding something to public OnPlayerKeyStateChange (ERROR) ArTisT Help Archive 2 09/02/2010 07:00 PM
[Questions] Teams, Commands, Binding. fsnameless Help Archive 4 03/01/2010 06:05 AM
[Solved]Binding Key's to animations Buwla Help Archive 4 03/07/2009 03:51 PM
Nitro? decayer Help Archive 9 17/02/2009 04:02 AM


All times are GMT. The time now is 07:35 AM.


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