Is my coding right?
#1

I keep getting erros and i may just be putting it in the wrong spot
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys==KEY_HANDBRAKE)//your key here
              {
        if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
        { //POLICE GATE
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgategar==0)
            {
                pdgategar = 1;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
            }
            else if(pdgategar==1)
            {
                pdgategar = 0;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
        { //POLICE BAR
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgatebar==0)
            {
                pdgatebar = 1;
                SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
            }
            else if(pdgatebar==1)
            {
                pdgatebar = 0;
                SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,96.8500, 1923.4334, 15.3518))
        { //PRISON GATE
            if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP / NG !");
            if(Prison_Buttons[GateOpened] == 0)
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1923.5, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 1;
                Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
            }
            else
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1920.512817, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 0;
                KillTimer(Prison_Buttons[GateTimerID]);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, -80.057670593262, -352.7497253418, 3.2030787467957))
        { //SECRET SOCIETY GATE
            if(!(PlayerInfo[playerid][pMember] == 7)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the Secret Society !");
            if(ssgateopen == 0)
            {
                ssgateopen = 1;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 7.6630787467957, 1.500000);
            }
            else
            {
                ssgateopen = 0;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 3.2030787467957, 1.500000);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, 1027.46203613, 1183.29357910, 12.45144653))
        { //FBI GATE
            if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the FBI !");
            if(fbigateopen == 0)
            {
                fbigateopen = 1;
                MoveObject(FBIGate, 1038.17248535, 1183.50256348, 12.45144653, 1.500000);
            }
            else
            {
                fbigateopen = 0;
                MoveObject(FBIGate, 1027.46203613,1183.29357910,12.45144653, 1.500000);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You are not near a gate !");
            return 1;
        }
        return 1;
    }
Reply
#2

Change:
pawn Код:
if(newkeys==KEY_HANDBRAKE)
To:
pawn Код:
if (newkeys & KEY_HANDBRAKE)
Reply
#3

pawn Код:
/*...*/
        else
        {
            fbigateopen = 0;
            MoveObject(FBIGate, 1027.46203613,1183.29357910,12.45144653, 1.500000);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "   You are not near a gate !");
        //NO return 1; You can't return 1 here.
    }
    return 1;
}
Reply
#4

Код:
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2273) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2348) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2348) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2362) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2362) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2378) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2378) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2394) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2408) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2424) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2426) : warning 217: loose indentation
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2426) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2426) : error 004: function "OnPlayerClickPlayer" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2429) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2440) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2441) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2443) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2446) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2448) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2453) : error 017: undefined symbol "clickedplayerid"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2457) : error 079: inconsistent return types (array & non-array)
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2460) : warning 225: unreachable code
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2460) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2460) : error 004: function "BackupClear" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2464) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2472) : error 004: function "IsACop" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2475) : error 004: function "SetPlayerToTeamColor" is not implemented
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2479) : error 017: undefined symbol "calledbytimer"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#5

You are missing a

pawn Код:
}
at the end.
Reply
#6

Код:
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(2427) : warning 209: function "OnPlayerKeyStateChange" should return a value
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(11663) : error 021: symbol already defined: "OnPlayerKeyStateChange"
Do i have to define it in the script?
#define OnPlayerKeyStateChange
Reply
#7

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys==KEY_HANDBRAKE)//your key here
              {
        if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
        { //POLICE GATE
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgategar==0)
            {
                pdgategar = 1;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
            }
            else if(pdgategar==1)
            {
                pdgategar = 0;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
        { //POLICE BAR
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgatebar==0)
            {
                pdgatebar = 1;
                SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
            }
            else if(pdgatebar==1)
            {
                pdgatebar = 0;
                SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,96.8500, 1923.4334, 15.3518))
        { //PRISON GATE
            if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP / NG !");
            if(Prison_Buttons[GateOpened] == 0)
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1923.5, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 1;
                Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
            }
            else
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1920.512817, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 0;
                KillTimer(Prison_Buttons[GateTimerID]);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, -80.057670593262, -352.7497253418, 3.2030787467957))
        { //SECRET SOCIETY GATE
            if(!(PlayerInfo[playerid][pMember] == 7)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the Secret Society !");
            if(ssgateopen == 0)
            {
                ssgateopen = 1;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 7.6630787467957, 1.500000);
            }
            else
            {
                ssgateopen = 0;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 3.2030787467957, 1.500000);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, 1027.46203613, 1183.29357910, 12.45144653))
        { //FBI GATE
            if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the FBI !");
            if(fbigateopen == 0)
            {
                fbigateopen = 1;
                MoveObject(FBIGate, 1038.17248535, 1183.50256348, 12.45144653, 1.500000);
            }
            else
            {
                fbigateopen = 0;
                MoveObject(FBIGate, 1027.46203613,1183.29357910,12.45144653, 1.500000);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You are not near a gate !");
            return 1;
        }
        return 1;
    }
    return 1;
}
And if you have something like
pawn Код:
new OnPlayerKeyStateChange[MAX_PLAYERS];
remove that.
Reply
#8

Quote:
Originally Posted by maramizo
Посмотреть сообщение
And if you have something like
pawn Код:
new OnPlayerKeyStateChange[MAX_PLAYERS];
remove that.
I didn't have that and im useing the code you made
Код:
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(11767) : error 021: symbol already defined: "OnPlayerKeyStateChange"
C:\Documents and Settings\Robert Crawford\Desktop\Vanity Role Play\gamemodes\VR111a.pwn(11851) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#9

Well, here is a proper code.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_HANDBRAKE)//your key here
    {
        if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
        { //POLICE GATE
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgategar==0)
            {
                pdgategar = 1;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
            }
            else if(pdgategar==1)
            {
                pdgategar = 0;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
        { //POLICE BAR
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgatebar==0)
            {
                pdgatebar = 1;
                SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
            }
            else if(pdgatebar==1)
            {
                pdgatebar = 0;
                SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,96.8500, 1923.4334, 15.3518))
        { //PRISON GATE
            if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP / NG !");
            if(Prison_Buttons[GateOpened] == 0)
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1923.5, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 1;
                Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
            }
            else
            {
                MoveObject(Prison_Buttons[PrisonGate], 96.808670, 1920.512817, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 0;
                KillTimer(Prison_Buttons[GateTimerID]);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, -80.057670593262, -352.7497253418, 3.2030787467957))
        { //SECRET SOCIETY GATE
            if(!(PlayerInfo[playerid][pMember] == 7)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the Secret Society !");
            if(ssgateopen == 0)
            {
                ssgateopen = 1;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 7.6630787467957, 1.500000);
            }
            else
            {
                ssgateopen = 0;
                MoveObject(ssgate, -80.057670593262, -352.7497253418, 3.2030787467957, 1.500000);
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid, 12.0, 1027.46203613, 1183.29357910, 12.45144653))
        { //FBI GATE
            if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a member of the FBI !");
            if(fbigateopen == 0)
            {
                fbigateopen = 1;
                MoveObject(FBIGate, 1038.17248535, 1183.50256348, 12.45144653, 1.500000);
            }
            else
            {
                fbigateopen = 0;
                MoveObject(FBIGate, 1027.46203613,1183.29357910,12.45144653, 1.500000);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You are not near a gate !");
        }
    }
    return 1;
}
Reply
#10

I edited my code and fixed the loose identation.
Also upload your WHOLE script to pastebin or something. I need to take a better look.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)