Two times Y, for two different things.. [HELP]
#1

Hey, I have a problem, I have the x, y, z for my OnPlayerKeyStateChange and I have the Y to for year, for my report system. It give's errors, How can I use the letter y, two times for two different things?
Reply
#2

If you can explain it brother. Maybe i can help you? We understand more from the code your trying to make.

Thanks
Reply
#3

The Primary Y: new Float: y
The second Y: new Float: y1;
Reply
#4

Oke look:

This is what I need for my OnPlayerKeyStateChange:

pawn Код:
new bool:jumper[MAX_PLAYERS];
new Float:x,Float:y,Float:z;
And this is the thing himself:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    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);
            }
    if(PRESSED(KEY_JUMP) && jumper[playerid] == true){
    GetPlayerVelocity(playerid, x, y, z);
    SetPlayerVelocity(playerid, x, y, z+ 0.3);}
    return 1;
}
And this is the other different thing, were I need the letter Y to.. :

pawn Код:
CMD:report(playerid, params[])
{
    new str[128], id, reason[128], msg[356], hs, ms, sec, y, m, d, ip[16];
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "You must be type /report (id) (reason)");
    if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
    if(id == playerid) return ErrorMessages(playerid, 4);
    if(PlayerAcc[playerid][Admin] < PlayerAcc[id][Admin]) return ErrorMessages(playerid, 3);
    if(sscanf(params, "us[30]", id, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "You must be type /report [playerid] [reason]");
    getdate(y, m, d);
    gettime(hs, ms, sec);
    GetPlayerIp(id, ip, sizeof(ip));
    ServerInfo[ReporterName] = GetName(playerid);
    ServerInfo[TargetName] = GetName(id);
    ServerInfo[Reason] = reason;
    ServerInfo[H] = hs;
    ServerInfo[M] = ms;
    ServerInfo[S] = sec;
    format(str, sizeof(str), "PLANETS ADMIN REPORTS: %s(ID:%d) has reported %s(ID:%d) (Reason: %s)", GetName(playerid), playerid, GetName(id), id, reason);
    SendMessageToAdmin(COLOR_BROWN, str);
    SendClientMessage(playerid, COLOR_LIME, "Your report has been sended to the Online Admins!");
    format(msg, sizeof(msg), "Player %s(ID:%d) has reported %s(ID:%d) (Reason: %s) [Reported Player IP: %s]", m, d, y, hs, ms, sec, GetName(playerid), playerid, GetName(id), id, reason, ip);
    SaveIn("reports", msg);
    return 1;
}
And this are the errors:

Quote:

F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(147 : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(1737) : warning 204: symbol is assigned a value that is never used: "str"
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(174 : warning 204: symbol is assigned a value that is never used: "str"
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2064) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2094) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2117) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2245) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2299) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2557) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2837) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2899) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(2981) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3063) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "y" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3090) : warning 219: local variable "z" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3709) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3749) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(375 : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(3783) : warning 219: local variable "x" shadows a variable at a preceding level
F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(4125) : warning 219: local variable "y" shadows a variable at a preceding level

Reply
#5

I think you're adding the code below as a Global floating variables? You should make them local.

pawn Код:
new Float:x,Float:y,Float:z;
The code should be in here.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new Float:x,Float:y,Float:z;
    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);
            }
    if(PRESSED(KEY_JUMP) && jumper[playerid] == true){
    GetPlayerVelocity(playerid, x, y, z);
    SetPlayerVelocity(playerid, x, y, z+ 0.3);}
    return 1;
}

In case you still get errors and warnings. Post them here along with the code where your getting warnings or errors at?
Reply
#6

pawn Код:
new Float:x1,Float:y1,Float:z1;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    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);
            }
    if(PRESSED(KEY_JUMP) && jumper[playerid] == true){
    GetPlayerVelocity(playerid, x1, y1, z1);
    SetPlayerVelocity(playerid, x1, y1, z1+ 0.3);}
    return 1;
}
Reply
#7

Thanks guys, I have lost a lot of warnigs and errors now!,, I got still this one:

[quote]F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(63) : warning 201: redefinition of constant/macro (symbol "pInfo")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
quote]

But what the f*ck is a macro?
Reply
#8

[quote=mickos;2293740]Thanks guys, I have lost a lot of warnigs and errors now!,, I got still this one:

Quote:

F:\GTA San Andreas\Freeroam Server\pawno\Untitled.pwn(63) : warning 201: redefinition of constant/macro (symbol "pInfo")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
quote]

But what the f*ck is a macro?

Show line 63...
Reply
#9

This is line 63:
Quote:

{

Reply
#10

This is how you define a marco:

pawn Код:
#define macro 345

Show us the area where you are defining the symbol pInfo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)