Textdraw Problems
#1

Well, I have been following the tutorials in samp wiki , and basically it says i have to put this in right sections
pawn Код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:welcomeText;
 
public OnGameModeInit()
{
    // This line is used to create the textdraw.
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
 
public OnPlayerConnect(playerid)
{
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
}
So when I put this in , I get these errors.

C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\mygamemode.pwn(716) : error 055: start of function body without function header
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\mygamemode.pwn(719) : error 010: invalid function or declaration
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\mygamemode.pwn(720) : error 010: invalid function or declaration
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\mygamemode.pwn(744) : error 055: start of function body without function header
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\mygamemode.pwn(746) : error 021: symbol already defined: "TextDrawShowForPlayer"

Any solution? Not a pro scripter, (using tutorials to learn and stuff) ,and if i get these errors idk what to do tbh.
I specifically dont understand the error in 746 ... well ill also post like the bit i have , maybe you can tell me what the function header problem is .

737-747

pawn Код:
{
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
{
    TextDrawShowForPlayer(playerid,welcomeText);
    return 1;
}
So well...Any help is welcome , always willing to learn

PD: The last error I definetly dont understand , since i only have that word once in the whole script (?)
Reply
#2

Mind showing us lines 715 - 747, not just 737-747
Reply
#3

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Mind showing us lines 715 - 747, not just 737-747
Ok so here are the lines of the errors and a few previous ones. The errors are :

C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(939) : error 055: start of function body without function header
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(942) : error 010: invalid function or declaration
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(943) : error 010: invalid function or declaration
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(96 : error 055: start of function body without function header
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(970) : error 021: symbol already defined: "TextDrawShowForPlayer"


Here go the lines:

ERROR 055 , 010 , 010 :

LINES 929-944


pawn Код:
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("My Gamemode");
    AddPlayerClass(105,2592.9792,2791.0059,10.8203,84.3642,0,0,0,0,0,0);//grove
    AddStaticVehicle(442,-2544.2837,604.6541,14.2584,87.0854,40,36); // 348

    return 1;
}
{
    // This line is used to create the textdraw.
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
^
I forgot to add public ongamemodeinit , thats where all that is at
Now the next error , 055 and 021 .
Lines 951-971
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2592.9792,2791.0059,10.8203);
    SetPlayerFacingAngle(playerid,84.3642);
    SetPlayerCameraPos(playerid,2590.9873,2790.8960,10.8203);
    SetPlayerCameraLookAt(playerid, 2592.9792,2791.0059,10.8203);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
{
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
}

PD: the lines from the first errors have changed as I have added a few objects in the meanwhile of your answer, but it is still the same problems as in the first.
Reply
#4

Anyone ?
Reply
#5

Код:
public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
    return 1;
}
Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("My Gamemode");
    AddPlayerClass(105,2592.9792,2791.0059,10.8203,84.3642,0,0,0,0,0,0);//grove
    AddStaticVehicle(442,-2544.2837,604.6541,14.2584,87.0854,40,36); // 348

    // This line is used to create the textdraw.
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
Reply
#6

Thanks , but now I get this error:

C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(264) : error 017: undefined symbol "welcomeText"
C:\Users\Daniel\Desktop\samp03e_svr_win32\gamemode s\hooligansdm.pwn(967) : error 017: undefined symbol "welcomeText"

How can I define welcometext?

EDIT

I have done as you have just posted , and I get the undefined symbol problem still , both in the ongamemodeinit , and on onplayerconnect
Reply
#7

Put this on top under the include.

Код:
new Text:welcomeText;
Reply
#8

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Put this on top under the include.

Код:
new Text:welcomeText;
Thanks! didnґt know it had to go there.
+REP
Reply
#9

well my problem is not this. I do lot but nothing happen
my actual problem is the text draw doesn't show. But my code is correct, no errors and no crashes but it doesn't
Is there any additional include for for this text draw or Whats the problem any one help me please


here is my code and you can check that

CMD:health(playerid, params[])
{
new Float: Health, Text:Textdraw, string[128];
GetPlayerHealth(playerid, Health);
format(string, sizeof(string), "Health: %d", floatround(Health));
Textdraw = TextDrawCreate(473, 382, string);
TextDrawShowForPlayer(playerid, Textdraw);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)