SA-MP Forums Archive
/hotwire - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /hotwire (/showthread.php?tid=156556)



/hotwire - SisasPoiss - 23.06.2010

Lock



Re: /hotwire - iggy1 - 23.06.2010

pawn Код:
// Hotwire
        if(strcmp(cmdtext, "/hotwire", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pJob] == 5)
        {
          if(IsPlayerInAnyVehicle(playerid))
                {
                    new timestamp = GetTickCount();
                    LastHW[playerid] = timestamp;

                    if(timestamp - LastHW[playerid] < 5000)
                    {
                        SendClientMessage(playerid, COLOR_RED, "Your trying to hotwire it.");
                        SetTimerEx("HotwireSucces", 5000, 0, "i", playerid);
                }
              }
            }
        }
        return 1;
    }
Try that


Re: /hotwire - Lorenc_ - 23.06.2010

Add this piece of Code

Код:
new vehicleid = GetPlayerVehicleID(playerid);
Should work now

-Lorenc


Re: /hotwire - SisasPoiss - 23.06.2010

Quote:
Originally Posted by » Lorenc « (back)
Add this piece of Code

Код:
new vehicleid = GetPlayerVehicleID(playerid);
Should work now

-Lorenc
If I add it, my pawno crashes


Re: /hotwire - Lorenc_ - 23.06.2010

Quote:
Originally Posted by iggy1
pawn Код:
// Hotwire
        if(strcmp(cmdtext, "/hotwire", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pJob] == 5)
        {
          if(IsPlayerInAnyVehicle(playerid))
                {
                    new timestamp = GetTickCount();
                    LastHW[playerid] = timestamp;

                    if(timestamp - LastHW[playerid] < 5000)
                    {
                        SendClientMessage(playerid, COLOR_RED, "Your trying to hotwire it.");
                        SetTimerEx("HotwireSucces", 5000, 0, "i", playerid);
                }
              }
            }
        }
        return 1;
    }
Try that
Hmm? Whats new about this code is nothing but the indentation (i think) ... Doubting that would fix an error.


Edit: my bad thought it was the same one as b4 :P try this?


Re: /hotwire - iggy1 - 23.06.2010

Lol
pawn Код:
if(IsPlayerInVehicle(playerid, vehicleid))//his code
pawn Код:
if(IsPlayerInAnyVehicle(playerid))//mine
mine checks if a player is in any vehicle without the need of making a new variable. no need to use the param vehicleid.

Edit:typo


Re: /hotwire - Lorenc_ - 23.06.2010

Quote:
Originally Posted by SisasPoiss
Quote:
Originally Posted by » Lorenc « (back)
Add this piece of Code

Код:
new vehicleid = GetPlayerVehicleID(playerid);
Should work now

-Lorenc
If I add it, my pawno crashes
Very strange. Did you add it correctly ??

Should be like this:
Код:
// Hotwire
		if(strcmp(cmdtext, "/hotwire", true) == 0)
	{
      new vehicleid = GetPlayerVehicleID(playerid);
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerInfo[playerid][pJob] == 5)
	    {
	      if(IsPlayerInVehicle(playerid, vehicleid))
				{
					new timestamp = GetTickCount();
					LastHW[playerid] = timestamp;

					if(timestamp - LastHW[playerid] < 5000)
					{
						SendClientMessage(playerid, COLOR_RED, "Your trying to hotwire it.");
						SetTimerEx("HotwireSucces", 5000, 0, "i", playerid);
  				}
			  }
 			}
		}
		return 1;
	}



Re: /hotwire - iggy1 - 23.06.2010

Did u try my code?


Re: /hotwire - SisasPoiss - 23.06.2010

Quote:
Originally Posted by iggy1
Did u try my code?
Iggy, your code is working in pawno


Re: /hotwire - iggy1 - 23.06.2010