Can't put textdraw system working
#1

Hi guys, so I'm here with a little problem with my code, so the system is when a player comes to the server it shoes a textdraw like " player enter in te server ", I already did the textdraw, and that thing, the script hasn't errors, but has some warnings. So here's the script:

Код:
	static string1[144]; //line 221
    GetPlayerName(playerid, name, sizeof(name)); 
  foreach(new i: Player)
  {
  SendClientMessage(playerid, branco, " sк bem-vindo ao {009BFFFF} Portugal Rising {FFFFFF} Roleplay!"); // branco = white, sк bem vindo ao portugal Rising Roleplay = Be welcome to my server
  format(string1, sizeof(string1), "%s entrou no servidor.",RemoveUnderScore(playerid)); // string playerid enters in the server
  new Text:Textdraw0; // the textdraw
  Textdraw0 = TextDrawCreate(7.000000, 425.000000, string1); // the string
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.210000, 0.799999);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 83886165);
TextDrawTextSize(Textdraw0, 140.000000, -63.000000);
TextDrawSetSelectable(Textdraw0, 0);
  TextDrawShowForAll(Textdraw0);
  }

  return 1;
  }
So, here's the warnings


Код:
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(221) : warning 225: unreachable code
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(221) : warning 217: loose indentation
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(223) : warning 217: loose indentation
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(229) : warning 217: loose indentation
C:\Users\Joka\Desktop\New folder (2)\gamemodes\GamemodeRP.pwn(240) : warning 217: loose indentation
Edit: This script is " OnPlayerConnect "
Reply
#2

warning 217: loose indentation is for indent problems which is not a thing to worry about if you are a starter, anyways ****** this "indentation" and take a look at it what it is. And for the warning 225: unreachable code warning, it's a issue to be worry about. Show us some lines before it or maybe the whole callback OnPlayerConnect().
Reply
#3

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
warning 217: loose indentation is for indent problems which is not a thing to worry about if you are a starter, anyways ****** this "indentation" and take a look at it what it is. And for the warning 225: unreachable code warning, it's a issue to be worry about. Show us some lines before it or maybe the whole callback OnPlayerConnect().
Here it is:

PHP код:
public OnPlayerConnect(playerid)
{
new 
name [MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(
strfind(name"0"true) != -|| strfind(name"1"true) != -|| strfind(name"2"true) != -|| strfind(name"3"true) != -|| strfind(name"4"true) != -|| strfind(name"5"true) != -1
        
|| strfind(name"6"true) != -|| strfind(name"7"true) != -|| strfind(name"8"true) != -|| strfind(name"9"true) != -|| strfind(name"["true) != -|| strfind(name"]"true) != -1)
  {
        
SendClientMessage(playeridamarelo"|======================================|");
        
SendClientMessage(playeridamarelo"Foste Kickado por:  {FFFFFF} Nome non-rp");
        
SendClientMessage(playeridamarelo"Nome RP: {FFFFFF} Nome_Apelido");
        
SendClientMessage(playeridamarelo"Exemplo: {FFFFFF} Rui_Pimentel");
        
SendClientMessage(playeridamarelo"|======================================|");
        
SetTimerEx("DelayedKick"1000false"d"playerid);
        
  }
  else if(
strfindname"_"true) == -1)
  {
        
SendClientMessage(playeridamarelo"|======================================|");
        
SendClientMessage(playeridamarelo"Foste Kickado por:  {FFFFFF} Nome non-rp");
        
SendClientMessage(playeridamarelo"Nome RP: {FFFFFF} Nome_Apelido");
        
SendClientMessage(playeridamarelo"Exemplo: {FFFFFF} Rui_Pimentel");
        
SendClientMessage(playeridamarelo"|======================================|");
        
SetTimerEx("DelayedKick"1000false"d"playerid);
  }
  
  return 
1
Reply
#4

Where is that piece of code? You said it is in OnPlayerConnect(). Show us the callback of where that code is.
Reply
#5

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Where is that piece of code? You said it is in OnPlayerConnect(). Show us the callback of where that code is.
Sorry I'm noob i want to mean public OnPlayerConnect
Reply
#6

Bump
Reply
#7

This goes to the start of the script (put it somewhere near the others "new")
Quote:

new Text:Textdraw0; // the textdraw

This goes to "OnPlayerConnect"
Quote:

Textdraw0 = TextDrawCreate(7.000000, 425.000000, string1); // the string
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.210000, 0.799999);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 83886165);
TextDrawTextSize(Textdraw0, 140.000000, -63.000000);
TextDrawSetSelectable(Textdraw0, 0);

And let the
Quote:

TextDrawShowForAll(Textdraw0);

Reply
#8

Tried that, no errors, but the script still doesn't work
Reply
#9

Listen, if the text draw is supposed to be shown for all the players all the time, just create it under OnGameModeInit, set the text draw string and show it to all players under OnPlayerConnect.
Reply
#10

But the textdraw is each player that connects to the server, so how do I detect if a player connects OnGameModeInit?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)