Can you tell me what's the problem?
#1

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    new vehicleid=GetPlayerVehicleID(playerid);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       GetVehicleModel(vehicleid);
       if(vehicleid == 431)
       {
          GetPlayerSpeed(playerid,true);
          if(GetPlayerSpeed(playerid,true) > 60)
          {
             GameTextForPlayer(playerid,"A bomb has been planted on your bus,don't slow down below 50mph or you'll be blowed up",7500,4);
             if(PRESSED(KEY_BRAKE/REVERSE))
             {
                GetPlayerSpeed(playerid,true);
                if(GetPlayerSpeed(playerid,true) < 50)
                {
                   SetVehicleHealth(vehicleid,0);
                   SendClientMessage(playerid,RED,"BYE BYE!!!");
                }
             }
          }
       }
     }
    return 1;
}
Compiling errors:

D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\lsdm.pwn(3 72) : error 017: undefined symbol "newkeys"
Reply
#2

You put that in OnPlayerKeyStateChange not OnPlayerStateChange!
Reply
#3

lolz I did this

public OnPlayerKeyStateChange
{
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
return 1;
}

Compiling errors : undefined PRESSED
Reply
#4

Hey WHY the hell are you adding a PRESSED define into OnPlayerStateChange( I just noticed ).
Reply
#5

I deleted it from there and added it to OnPlayerKeyStateChange as you told me but still thaat error.DO YOU KNOW HOW MUCH TOOK me to do that script,first i tried with dialogs(spammed all froum with my topics :P),and now I gave up the dialog idea and tried this,and this seem to be working only 1 ewrror udnefined PRESS
Reply
#6

more exaxtly I did this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{

    new vehicleid=GetPlayerVehicleID(playerid);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       GetVehicleModel(vehicleid);
       if(vehicleid == 431)
       {
          GetPlayerSpeed(playerid,true);
          if(GetPlayerSpeed(playerid,true) > 60)
          {
             GameTextForPlayer(playerid,"A bomb has been planted on your bus,don't slow down below 50mph or you'll be blowed up",7500,4);
             if(PRESSED(KEY_BRAKE/REVERSE))
             {
                GetPlayerSpeed(playerid,true);
                if(GetPlayerSpeed(playerid,true) < 50)
                {
                   SetVehicleHealth(vehicleid,0);
                   SendClientMessage(playerid,RED,"BYE BYE!!!");
                }
             }
          }
       }
     }
    return 1;
}

public OnPlayerKeyStateChange
{
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    return 1;
}
Reply
#7

Put it at the top of your gm with your other defines. Not in a callback.

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Simple.
Reply
#8

OK,I did that now the script looks like this:

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerStateChange(playerid, newstate, oldstate)
{

    new vehicleid=GetPlayerVehicleID(playerid);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       GetVehicleModel(vehicleid);
       if(vehicleid == 431)
       {
          GetPlayerSpeed(playerid,true);
          if(GetPlayerSpeed(playerid,true) > 60)
          {
             GameTextForPlayer(playerid,"A bomb has been planted on your bus,don't slow down below 50mph or you'll be blowed up",7500,4);
             if(PRESSED(KEY_BRAKE/REVERSE))
             {
                GetPlayerSpeed(playerid,true);
                if(GetPlayerSpeed(playerid,true) < 50)
                {
                   SetVehicleHealth(vehicleid,0);
                   SendClientMessage(playerid,RED,"BYE BYE!!!");
                }
             }
          }
       }
     }
    return 1;
}
Compiling error: Undefined symbol newkeys explain this to me Stigg
Reply
#9

Because your command is supposed to go under:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Not:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
Reply
#10

good thanks now the only error is KEY_BRAKE/REVERSE also tried KEY_BRAKE(becasue I saw on GetVehicleVelocity tutorial a statement KEY_HANDBRAKE),so what's the problem(error is undefined symbol key_brake)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)