SA-MP Forums Archive
new pname erors ;/ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: new pname erors ;/ (/showthread.php?tid=202077)



new pname erors ;/ - propilot - 23.12.2010

hey I made /takeoff, /land script now now I am getting LOTS of warrnings
Код:
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(1908) : warning 217: loose indentation
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13386) : warning 235: public function lacks forward declaration (symbol "timer_reset")
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13397) : warning 235: public function lacks forward declaration (symbol "timer_transmitted")
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13411) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13428) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13445) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13462) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13491) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13508) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13525) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13542) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(498) : warning 204: symbol is assigned a value that is never used: "GodTimer"
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(497) : warning 204: symbol is assigned a value that is never used: "PingTimer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Warnings.
any reason why it does that?


Re: new pname erors ;/ - Steven82 - 23.12.2010

Your pName variable is defined more than once in the command itself, or you have added it globally and it won't work since your trying to use it locally.


Re: new pname erors ;/ - sooky - 23.12.2010

You can rename the pName's in question to plname.


Re: new pname erors ;/ - propilot - 23.12.2010

None of the commands work after this warning exp /takeoff and /land
pawn Код:
public timer_reset(airfield)
{
    switch(airfield) {
        case 0: lsa = 0;
        case 1: lva = 0;
        case 2: sfa = 0;
        case 3: a69 = 0;
    }
}


public timer_transmitted(land,playerid)
{
    if (land == 1) {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476:
            {
                new string[64];
//lsa
                if (IsPlayerInRangeOfPoint(playerid,700,2061.8948,-2379.8354,16.1250) == 1) {
                    if (lsa == 0) {
                        lsa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",0);
                        format(string,sizeof string,"~w~Los Santos Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is landing at Lsa",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Los Santos Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//lva
                } else if (IsPlayerInRangeOfPoint(playerid,700,1306.2268,1262.2083,14.2656 ) == 1)
                {
                    if (lva == 0) {
                        lva = 1;
                        SetTimerEx("timer_reset",20000,false,"i",1);
                        format(string,sizeof string,"~w~Las Venturas Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is landing at LVA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Las Venturas Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//sfa
                } else if (IsPlayerInRangeOfPoint(playerid,700,-1294.7537,62.1835,14.1484) == 1)
                {
                    if (sfa == 0) {
                        sfa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",2);
                        format(string,sizeof string,"~w~San Fierro Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is landing at SFA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~San Fierro Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//a69
                } else if (IsPlayerInRangeOfPoint(playerid,500,312.1916,2011.1819,17.6406) == 1)
                {
                    if (a69 == 0) {
                        a69 = 1;
                        SetTimerEx("timer_reset",20000,false,"i",4);
                        format(string,sizeof string,"~w~Area 69: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is landing at A69",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Area 69: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
                }
                else {
                    format(string,sizeof string,"~r~Could not transmit to any nearby airport!");
                    GameTextForPlayer(playerid, string,6500,6);
                }
            }
        }
    }
    else {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476:
            {
                new string[64];
//lsa
                if (IsPlayerInRangeOfPoint(playerid,700,2061.8948,-2379.8354,16.1250) == 1) {
                    if (lsa == 0) {
                        lsa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",0);
                        format(string,sizeof string,"~w~Los Santos Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is taking off from LSA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Los Santos Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//lva
                } else if (IsPlayerInRangeOfPoint(playerid,700,1306.2268,1262.2083,14.2656 ) == 1)
                {
                    if (lva == 0) {
                        lva = 1;
                        SetTimerEx("timer_reset",20000,false,"i",1);
                        format(string,sizeof string,"~w~Las Venturas Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is taking off from LVA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Las Venturas Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//sfa
                } else if (IsPlayerInRangeOfPoint(playerid,700,-1294.7537,62.1835,14.1484) == 1)
                {
                    if (sfa == 0) {
                        sfa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",2);
                        format(string,sizeof string,"~w~San Fierro Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is taking off from SFA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~San Fierro Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//a69
                } else if (IsPlayerInRangeOfPoint(playerid,500,312.1916,2011.1819,17.6406) == 1)
                {
                    if (a69 == 0) {
                        a69 = 1;
                        SetTimerEx("timer_reset",20000,false,"i",4);
                        format(string,sizeof string,"~w~Area 69: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        new pName[64];
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof string,"Radio: %s is taking off from A69",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof string,"~w~Area 69: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
                }
            }
        }
    }
}
that the script


Re: new pname erors ;/ - Lorenc_ - 23.12.2010

For now use

pawn Код:
stock ReturnPlayerName(playerid)                  //By Alex "******" Cole
{
    new pName[MAX_PLAYER_NAME];
    pName="Invalid PlayerID";
    if(IsPlayerConnected(playerid)) {
        GetPlayerName(playerid, pName, sizeof (pName));
    }
    return pName;
}
It'd be better.


Re: new pname erors ;/ - propilot - 23.12.2010

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
For now use

pawn Код:
stock ReturnPlayerName(playerid)                  //By Alex "******" Cole
{
    new pName[MAX_PLAYER_NAME];
    pName="Invalid PlayerID";
    if(IsPlayerConnected(playerid)) {
        GetPlayerName(playerid, pName, sizeof (pName));
    }
    return pName;
}
It'd be better.
Where do I put it?


Re: new pname erors ;/ - sooky - 23.12.2010

Quote:
Originally Posted by propilot
Посмотреть сообщение
Where do I put it?
Outside, quite literally.

Add it to the end of your script or somewhere. Where your other custom functions & stocks are. Just make sure it's not inside another stock, function or callback.


Re: new pname erors ;/ - propilot - 23.12.2010

Quote:
Originally Posted by sooky
Посмотреть сообщение
Outside, quite literally.

Add it to the end of your script or somewhere. Where your other custom functions & stocks are. Just make sure it's not inside another stock, function or callback.
same warnings


Re: new pname erors ;/ - propilot - 23.12.2010

bump sorry ;/ ;'(


Re: new pname erors ;/ - rjjj - 23.12.2010

I did it

pawn Код:
forward timer_reset(airfield);
public timer_reset(airfield)
{
    switch(airfield) {
        case 0: lsa = 0;
        case 1: lva = 0;
        case 2: sfa = 0;
        case 3: a69 = 0;
    }
}

forward timer_transmitted(land,playerid);
public timer_transmitted(land,playerid)
{
    new pName[MAX_PLAYER_NAME];
    new string[128];
    if (land == 1) {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476:
            {
//lsa
                if (IsPlayerInRangeOfPoint(playerid,700,2061.8948,-2379.8354,16.1250) == 1) {
                    if (lsa == 0) {
                        lsa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",0);
                        format(string,sizeof(string),"~w~Los Santos Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is landing at Lsa",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Los Santos Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//lva
                } else if (IsPlayerInRangeOfPoint(playerid,700,1306.2268,1262.2083,14.2656 ) == 1)
                {
                    if (lva == 0) {
                        lva = 1;
                        SetTimerEx("timer_reset",20000,false,"i",1);
                        format(string,sizeof(string),"~w~Las Venturas Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is landing at LVA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Las Venturas Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//sfa
                } else if (IsPlayerInRangeOfPoint(playerid,700,-1294.7537,62.1835,14.1484) == 1)
                {
                    if (sfa == 0) {
                        sfa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",2);
                        format(string,sizeof(string),"~w~San Fierro Airport: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is landing at SFA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~San Fierro Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//a69
                } else if (IsPlayerInRangeOfPoint(playerid,500,312.1916,2011.1819,17.6406) == 1)
                {
                    if (a69 == 0) {
                        a69 = 1;
                        SetTimerEx("timer_reset",20000,false,"i",4);
                        format(string,sizeof(string),"~w~Area 69: ~g~You are allowed to land.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is landing at A69",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Area 69: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
                }
                else {
                    format(string,sizeof(string),"~r~Could not transmit to any nearby airport!");
                    GameTextForPlayer(playerid, string,6500,6);
                }
            }
        }
    }
    else {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid))) {
            case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476:
            {
//lsa
                if (IsPlayerInRangeOfPoint(playerid,700,2061.8948,-2379.8354,16.1250) == 1) {
                    if (lsa == 0) {
                        lsa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",0);
                        format(string,sizeof(string),"~w~Los Santos Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is taking off from LSA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Los Santos Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//lva
                } else if (IsPlayerInRangeOfPoint(playerid,700,1306.2268,1262.2083,14.2656 ) == 1)
                {
                    if (lva == 0) {
                        lva = 1;
                        SetTimerEx("timer_reset",20000,false,"i",1);
                        format(string,sizeof(string),"~w~Las Venturas Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is taking off from LVA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Las Venturas Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//sfa
                } else if (IsPlayerInRangeOfPoint(playerid,700,-1294.7537,62.1835,14.1484) == 1)
                {
                    if (sfa == 0) {
                        sfa = 1;
                        SetTimerEx("timer_reset",20000,false,"i",2);
                        format(string,sizeof(string),"~w~San Fierro Airport: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is taking off from SFA",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~San Fierro Airport: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
//a69
                } else if (IsPlayerInRangeOfPoint(playerid,500,312.1916,2011.1819,17.6406) == 1)
                {
                    if (a69 == 0) {
                        a69 = 1;
                        SetTimerEx("timer_reset",20000,false,"i",4);
                        format(string,sizeof(string),"~w~Area 69: ~g~You are allowed to takeoff.");
                        GameTextForPlayer(playerid,string,6500,6);
                        GetPlayerName(playerid,pName,64);
                        format(string,sizeof(string),"Radio: %s is taking off from A69",pName);
                        SendClientMessageToAll(COLOR_RADIO,string);
                    }
                    else {
                        format(string,sizeof(string),"~w~Area 69: ~r~Negative, runway in-use");
                        GameTextForPlayer(playerid,string,6500,6);
                    }
                }
            }
        }
    }
}

I hope that i have helped