Key problem
#1

I wanted to ask because if I put this in KeyStateChange:
pawn Код:
if(newkeys &= 4)
    {
       if(IsPlayerInAnyVehicle(playerid))
       {
        new sendername[MAX_PLAYER_NAME];
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(vid != INVALID_VEHICLE_ID)
        //if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "Devi essere in un veicolo per fare questo!");
        //if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Puт farlo solo il guidatore!");
        //Ricorda
        if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
        {
            SendClientMessage(playerid, -1, ""#COL_WHITE"> Hai "#COL_GREEN"acceso"#COL_WHITE" il motore");
            GetPlayerRPName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s gira una chiave ed accende il motore.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        else if(engine == VEHICLE_PARAMS_ON)
        {
            SendClientMessage(playerid, -1, ""#COL_WHITE"> Hai "#COL_RED"spento"#COL_WHITE" il motore");
            GetPlayerRPName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s gira una chiave e spegne il motore.", PlayerName(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
    }
  }
This doesen't work:
pawn Код:
if(newkeys == KEY_SECONDARY_ATTACK)
    {
   
        if(IsPlayerConnected(playerid))
        {
        if(IsPlayerInRangeOfPoint(playerid, 3, 246.3489,72.0905,1003.6406))
                {
                 if(IsACop(playerid))
                 {
                    new name[MAX_PLAYER_NAME];
                    GetPlayerRPName(playerid, name, sizeof(name));
                    if(IsPlayerConnected(playerid))
                    {
                        if(IsLSPDDoorOpen == 0)
                        {
                            MoveDynamicObject(LSPD_Door[ObjectID1], 247.3080, 72.3000, 1003.6700, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID2], 245.480, 72.5750, 1003.6650, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID3], 247.888, 72.4500, 1003.7000, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID4], 244.908, 72.4500, 1003.7000, 1.50);
                            IsLSPDDoorOpen = 1;
                            format(string, sizeof(string), "* %s apre la porta della centrale.", name);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                        if(IsLSPDDoorOpen == 1)
                        {
                            MoveDynamicObject(LSPD_Door[ObjectID1], 246.4050, 72.3000, 1003.6700, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID2], 246.4050, 72.5750, 1003.6650, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID3], 246.9850, 72.4500, 1003.7000, 1.50);
                            MoveDynamicObject(LSPD_Door[ObjectID4], 245.8330, 72.4500, 1003.7000, 1.50);
                            IsLSPDDoorOpen = 0;
                            format(string, sizeof(string), "* %s chiude la porta della centrale", name);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                }
                if(IsPlayerInRangeOfPoint(playerid, 3, 222.09, 70.57, 1004.00))
                {
                    if(IsPlayerConnected(playerid))
                    {
                        if(DoorOpened==0)
                        {
                            MoveDynamicObject(door, 222.21, 72.27, 1004.00, 3);
                            chiefdoortimer = SetTimer("ClosePDDoor",3000,0);
                            DoorOpened = 1;
                        }
                        else if(DoorOpened==1)
                        {
                            MoveDynamicObject(door, 222.09, 70.57, 1004.00, 3);
                            KillTimer(chiefdoortimer);
                            DoorOpened = 0;
                        }
                    }
                }
            }
        }
            if(IsPlayerInRangeOfPoint(playerid, 1, 2021.9740,2235.6626,2103.9536))
            {
                new Float:busx, Float:busy, Float:busz, Float:angle;
                if(BusID[playerid] == 1)
                {
                    GetVehiclePos(NPCBlueBus, busx, busy, busz);
                    GetVehicleZAngle(NPCBlueBus, angle);
                }
                else
                {
                    GetVehiclePos(NPCBlackBus, busx, busy, busz);
                    GetVehicleZAngle(NPCBlackBus, angle);
                }
                GetPlayerRPName(playerid, string, sizeof(string));
                format(string, sizeof(string), "%s apre la porta ed esce dal bus.", string);
                for(new i=0; i<MAX_PLAYERS; i++)
                {
                    if(BusID[i] == BusID[playerid])
                    {
                        SendClientMessage(i, COLOR_PURPLE, string);
                    }
                }
                angle = 360 - angle;
                busx = floatsin(angle,degrees) * 1.5 + floatcos(angle,degrees) * 1.5 + busx;
                busy = floatcos(angle,degrees) * 1 - floatsin(angle,degrees) * 1 + busy;
                busz = 1 + busz;
                SetPlayerVirtualWorld(playerid, 0);
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, busx, busy, busz);
                BusID[playerid] = 0;
                KillTimer(costtimer);
                format(string, sizeof(string), "~r~-$%d", BusCost[playerid]);
                GameTextForPlayer(playerid, string, 3000, 1);
                GivePlayerMoney(playerid, -BusCost[playerid]);
                BusCost[playerid] = 0;
            }
        }
    }
Thanks.
Reply
#2

You detect keys like that:
pawn Код:
if( newkeys & KEY_ )
{
    // do something
}
Reply
#3

It doesen't work, Crashdetect says:
Quote:

[14:51:30] [debug] #1 000e1c3c in public cuff_OnPlayerKeyStateChange (0x00000002, 0x00000010, 0x00000000) from PLRP.amx
[14:51:30] [debug] #2 native CallLocalFunction () [00471c30] from samp-server.exe
[14:51:30] [debug] #3 00003628 in public OnPlayerKeyStateChange (0x00000002, 0x00000010, 0x00000000) from PLRP.amx

What I can do?!
Reply
#4

Something crashes your server. Do what this post says: http://forum.sa-mp.com/showpost.php?...32&postcount=7 and compile your PLRP.pwn again with the debug mode. If it gets crashed, show us again what it prints. In cases it shows some information about it.

PS: Update your crashdetect too, look at the last posts, there's 4.12 beta and 4.11.2 versions.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)