OnPlayerKeyStateChange help!
#1

Hey guys.

I just created two things in OnPlayerKeyStateChange. Two different things. But I got errors and it is wrong.. I dont know how to fix this..

This is it:

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
      {
          if(
PRESSED(KEY_JUMP) && jumper[playerid] == true){
        
GetPlayerVelocity(playeridxyz);
        
SetPlayerVelocity(playeridxyz0.3);}
    }
    return 
1;
    }
        if(
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)
        {
        if(
newkeys KEY_CROUCHAdvanceSpectate(playerid);
        else if(
newkeys KEY_JUMPReverseSpectate(playerid);
    }
        if(
IsBeingSpeced[playerid] == 1)
        {
        foreach(
Playeri)
        {
            if(
spectatorid[i] == playerid)
            {
                
SetPlayerInterior(iGetPlayerInterior(playerid));
                
SetPlayerVirtualWorld(iGetPlayerVirtualWorld(playerid));
            }
        }
    }
    return 
1;

And this are the errors:

PHP код:
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(772) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(774) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(775) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(777) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(779) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(781) : error 010invalid function or declaration
D
:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(788) : error 010invalid function or declaration 
And I think this is wrong to.. I mean the command to do it.

PHP код:
CMD:spsj(playeridparams[])
{
    new 
str[128];
    if(
PlayerAcc[playerid][Log] == 0) return SendClientMessage(playeridCOLOR_ORANGE"You are not logged in, please login first.");
    if(
PlayerAcc[playerid][Admin] >= 1)
    
GetPlayerVelocity(playeridxyz);
    
SetPlayerVelocity(playeridxyz0.3); //Forces the player to jump
    
SendClientMessage(playeridCOLOR_YELLOW"You have succesfully enabled super jump. /spsjo to turn it off.");        jumper[playerid]=true;
    return 
1;
}
 
CMD:spsjo(playeridparams[])
{
    new 
str[128];
    if(
PlayerAcc[playerid][Log] == 0) return SendClientMessage(playeridCOLOR_ORANGE"You are not logged in, please login first.");
    if(
PlayerAcc[playerid][Admin] >= 1)
    
GetPlayerVelocity(playeridxyz);
     
SetPlayerVelocity(playerid,0.0,0.0,0.0); //Forces the player to sink
     
SendClientMessage(playeridCOLOR_ORANGE"You have succesfully disabled super jump. /spsj to turn it on");        jumper[playerid]=false;
     return 
1;

I hope anyone can help me out of this!

Thanks for reading

Gr, mickos
Reply
#2

Can you please mention the lines?
Reply
#3

Sure

Line 772:

Quote:

if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)

Line 774:

Quote:

if(newkeys & KEY_CROUCH) AdvanceSpectate(playerid);

Line 775:

Quote:

else if(newkeys & KEY_JUMP) ReverseSpectate(playerid);

Line 777:

Quote:

if(IsBeingSpeced[playerid] == 1)

Line 779:

Quote:

foreach(Player, i)

Line 781:

Quote:

if(spectatorid[i] == playerid)

Line 788:

Quote:

return 1;

Reply
#4

Here there must be something related to the key:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)
P.S. Use pawn tags to paste a code.
Reply
#5

it doesnt work man
Reply
#6

Try this
pawn Код:
if(newkeys & KEY_CROUCH && GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)
        {
            AdvanceSpectate(playerid);
        }
        else if(newkeys & KEY_JUMP && GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)
        {
            ReverseSpectate(playerid);
        }
Instead of
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && spectatorid[playerid] != INVALID_PLAYER_ID)
        {
        if(newkeys & KEY_CROUCH) AdvanceSpectate(playerid);
        else if(newkeys & KEY_JUMP) ReverseSpectate(playerid);
    }
Reply
#7

Thx that errors are gone!

But now I got this..

pawn Код:
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(63) : warning 201: redefinition of constant/macro (symbol "pInfo")
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(85) : error 021: symbol already defined: "Reason"
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(1478) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(1737) : warning 204: symbol is assigned a value that is never used: "str"
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(1748) : warning 204: symbol is assigned a value that is never used: "str"
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "z" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3709) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3749) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3758) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3783) : warning 219: local variable "x" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(4125) : warning 219: local variable "y" shadows a variable at a preceding level
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(4161) : warning 203: symbol is never used: "AdminV"
D:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(4161) : warning 203: symbol is never used: "AnnCount"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
I think its because this:

PHP код:
new bool:jumper[MAX_PLAYERS];
new 
Float:x,Float:y,Float:z;
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Because ' y' use I already for a report system year namely...

But I need the Y to for the OnPlayerKeyStateChange.. What now?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)