need help at OnPlayerKeyStateChange
#1

well, what its id of key of Left button and Right button? I tried KEY_LEFT and Key_RIGHT but its not work, replace them working other buttons, like right button of mouse but not of keypad.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_YES)
    {
        if(PlayerToPoint(6,playerid,2125.5149,-2013.2430,13.5469))
        {
        if(GetPlayerJobID(playerid) == 5 || ShitInfo[playerid][openCar] == 1)
        {
            if(gatep == 0)
            {
                scm(playerid,COLOR_GREEN,"( ! ) You opened gate !");
                MoveObject(gate, 2117.97, -2025.10, 15.85,2.0);
                gatep = 1;
                return 1;
            }
            else
            {
                scm(playerid,COLOR_GREEN,"( ! ) You closed gate !");
                MoveObject(gate,2125.90, -2013.58, 15.85,2.0);
                gatep = 0;
            }
        }}
    }
    if(newkeys & KEY_LEFT)
    {
        if(ShitInfo[playerid][pSkiner] == 1)
        {
            if(ShitInfo[playerid][pSeeSkin] == 0)
            {
                ShitInfo[playerid][pSeeSkin] = 300;
            }
            ShitInfo[playerid][pSeeSkin]--;
            SetPlayerSkin(playerid,ShitInfo[playerid][pSeeSkin]);
            new strskin[256],ownskin[256];
            if(ZIP[ShitInfo[playerid][pSeeSkin]][sStatus] != 0)
            {
                format(ownskin,256,"~r~%s", ZIP[ShitInfo[playerid][pSeeSkin]][sOwner]);
            }
            else
            {
                format(ownskin,256,"~g~For Sale");
            }
            format(strskin,256,"Skin Information:~n~Skin ID:~b~%d~w~~n~Skin Owner:%s~w~~n~Skin Price:1000 GCash~n~Skin Name:~n~~g~%s",ShitInfo[playerid][pSeeSkin],ownskin,PlayerSkinName[ShitInfo[playerid][pSeeSkin]]);
            PlayerTextDrawSetString(playerid,TextDrawSkinInfo[playerid],strskin);
        }
    }
    else if(newkeys & KEY_RIGHT)
    {
        if(ShitInfo[playerid][pSkiner] == 1)
        {
            if(ShitInfo[playerid][pSeeSkin] == 300)
            {
                ShitInfo[playerid][pSeeSkin] = -1;
            }
            ShitInfo[playerid][pSeeSkin]++;
            SetPlayerSkin(playerid,ShitInfo[playerid][pSeeSkin]);
            new strskin[256],ownskin[256];
            if(ZIP[ShitInfo[playerid][pSeeSkin]][sStatus] != 0)
            {
            format(ownskin,256,"~r~%s", ZIP[ShitInfo[playerid][pSeeSkin]][sOwner]);
            }
            else
            {
            format(ownskin,256,"~g~For Sale");
            }
            format(strskin,256,"Skin Information:~n~Skin ID:~b~%d~w~~n~Skin Owner:%s~w~~n~Skin Price:1000 GCash~n~Skin Name:~n~~g~%s",ShitInfo[playerid][pSeeSkin],ownskin,PlayerSkinName[ShitInfo[playerid][pSeeSkin]]);
            PlayerTextDrawSetString(playerid,TextDrawSkinInfo[playerid],strskin);
        }
    }
return 1;
}
any ideas?
Reply
#2

Left, right, up and down are not called in OnPlayerKeyStateChange, you must use GetPlayerKeys in OnPlayerUpdate.
Reply
#3

damn, ok, I'll try
Reply
#4

work, ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)