/hotwire
#1

Lock
Reply
#2

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
Reply
#3

Add this piece of Code

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

-Lorenc
Reply
#4

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
Reply
#5

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?
Reply
#6

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
Reply
#7

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;
	}
Reply
#8

Did u try my code?
Reply
#9

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

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)