Welcome warning
#1

Hey guys!!!!

I tried to use the welcome text

pawn Код:
new Text:welcomeText;
new Text:infoText;

    welcomeText = TextDrawCreate(430,5,"~w~www.***********.com");
    infoText = TextDrawCreate(445,100, "~b~/cmds ~w~- /news -  ~r~/rules");

I get this warning in my script

pawn Код:
C:\Users\******\Desktop\*******B FILE\tg\*****\gamemodes\PPC_Trucking.pwn(292) : warning 204: symbol is assigned a value that is never used: "infoText"
C:\Users\******\Desktop\*******B FILE\tg\*****\gamemodes\PPC_Trucking.pwn(291) : warning 204: symbol is assigned a value that is never used: "welcomeText"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.
Can anyone help me please
Reply
#2

That's not warnings you should worry about. Those just say that you never use those variables anywhere in the script.

Ex:

Only typing this, without using it anywhere:
pawn Код:
new Number = 2;
Would output 'symbol is assigned a value that is never used: "Number"'

Now, this wouldn't output that warning:

pawn Код:
new Number = 2;

if(Number == 2) Number += 1; //ads 1 to Number variable (this, will _use_ the variable, making the symbol is not assigned a value error to go away.)
Reply
#3

You haven't used it, you only did on OnGameModeInit Try To put it OnPlayerConnect
pawn Код:
new Text:welcomeText;//Global Variable
new Text:infoText;//Global Variable

public OnGameModeInit
{
//Rest of codes
return 1;
}
public OnPlayerConnect
{
welcomeText = TextDrawCreate(430,5,"~w~www.***********.com");
infoText = TextDrawCreate(445,100, "~b~/cmds ~w~- /news -  ~r~/rules");
//Rest of codes
return 1;
}

public OnPlayerSpawn // to hide your text and for lress bugs
TextDrawHideForPlayer(playerid, welcometext);
TextDrawHideForPlayer(playerid, infotext);
//Rest of codes
return 1;
}
Reply
#4

Quote:
Originally Posted by pds2012
Посмотреть сообщение
You haven't used it, you only did on OnGameModeInit Try To put it OnPlayerConnect
pawn Код:
new Text:welcomeText;//Global Variable
new Text:infoText;//Global Variable

public OnGameModeInit
{
//Rest of codes
return 1;
}
public OnPlayerConnect
{
welcomeText = TextDrawCreate(430,5,"~w~www.***********.com");
infoText = TextDrawCreate(445,100, "~b~/cmds ~w~- /news -  ~r~/rules");
//Rest of codes
return 1;
}

public OnPlayerSpawn // to hide your text and for lress bugs
TextDrawHideForPlayer(playerid, welcometext);
TextDrawHideForPlayer(playerid, infotext);
//Rest of codes
return 1;
}
you're wrong, try this
pawn Код:
new Text:welcomeText;//Global Variable
new Text:infoText;//Global Variable

public OnGameModeInit
{
welcomeText = TextDrawCreate(430,5,"~w~www.***********.com");
infoText = TextDrawCreate(445,100, "~b~/cmds ~w~- /news -  ~r~/rules");
//Rest of codes
return 1;
}
public OnPlayerConnect
{
TextDrawShowForPlayer(playerid,welcomeText);
TextDrawShowForPlayer(playerid,infoText);
//Rest of codes
return 1;
}

public OnPlayerDisconnect(playerid,reason)
{ // to hide your text and for lress bugs
TextDrawHideForPlayer(playerid, welcomeText);
TextDrawHideForPlayer(playerid, infoText);
//Rest of codes
return 1;
}
Reply
#5

You could also use a timer to only show the welcome text for like 5 seconds:

pawn Код:
forward WelcomeText(playerid);
public WelcomeText(playerid)
{
    TextDrawHideForPlayer(playerid, welcomeText);
    TextDrawHideForPlayer(playerid, infoText);
}
pawn Код:
public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid,welcomeText);
    TextDrawShowForPlayer(playerid,infoText);
    SetTimerEx("WelcomeText", 5000, false, "i", playerid); //5000 is 5 seconds. 10000 is 10 seconds.
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)