Help with SetVehicleVelocity with OnPlayerKeyStateChange.
#1

Hello, I have a problem with SetPlayerVelocity with OnPlayerKeyStateChange.
I can't find the solution, here is the code, (I made a new script for testing it)

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE))
{
new
vehicleid = GetPlayerVehicleID(playerid);
if (vehicleid)
{
SetVehicleVelocity(playerid, 0.0, 0,5, 0.0);
}
}
return 1;
}
return 0;
}
Код:
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(14) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(14) : error 004: function "OnPlayerKeyStateChange" is not implemented
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(16) : warning 206: redundant test: constant expression is non-zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(22) : warning 202: number of arguments does not match definition
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(27) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Can someone help me? I got the OnPlayerKeyStateChange function on the wiki.

EDIT: Newer code:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (PRESSED(KEY_FIRE))
  {
    if(IsPlayerInAnyVehicle(playerid)) SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.0, 0,5, 0.0);
  }
  return 1;
}
Код:
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(14) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(14) : error 004: function "OnPlayerKeyStateChange" is not implemented
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(16) : warning 206: redundant test: constant expression is non-zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(18) : warning 202: number of arguments does not match definition
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Sa-mp 0.3\sa-mp 0.3a\filterscripts\cmdtests.pwn(22) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)