textdraw problem
#1

i have problem when someone join to the server i see his stats it is the script that i do:

Код:
#include <a_samp>
#include <RLSB>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

forward UpdateTD(playerid);
forward showstats(playerid);
new Text:TextLevel;
new Text:TextKills;
new Text:TextBank;
new stats[MAX_PLAYERS];
new bool:statsupdate[MAX_PLAYERS];
new string1[256];
new string2[256];
new string3[256];
#define COLOR_GREEN 0x33AA33AA
#define COLOR_WHITE 0xFFFFFFAA

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}



main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}



public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/showstats", true) == 0)
	{
		if(stats[playerid] == 0)
		{
      statsupdate[playerid] = true;
			showstats(playerid);
			SendClientMessage(playerid, COLOR_WHITE, ".дфтмъ аъ дсиаи дъойгй");
			TextDrawShowForPlayer(playerid,TextLevel);
			TextDrawShowForPlayer(playerid,TextKills);
			TextDrawShowForPlayer(playerid,TextBank);
			stats[playerid] = true;
		}
		else
		{
      statsupdate[playerid] = false;
			SendClientMessage(playerid, 0x083F6FF, ".бйимъ аъ дсиаи дъойгй");
			TextDrawHideForPlayer(playerid,TextLevel);
			TextDrawHideForPlayer(playerid,TextKills);
			TextDrawHideForPlayer(playerid,TextBank);
			stats[playerid] = false;
		}
 		return 1;
	}
	return 0;
}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public UpdateTD(playerid)
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
format(string1,sizeof(string1),"Level: %d",PlayerInfo[i][Level]);
TextDrawSetString(TextLevel,string1);
format(string2,sizeof(string2),"Kills: %d",PlayerInfo[i][Kills]);
TextDrawSetString(TextKills,string2);
format(string3,sizeof(string3),"Bank: %d",PlayerInfo[i][Bank]);
TextDrawSetString(TextBank,string3);
}
}
return 1;
}
public showstats(playerid)
{
	TextLevel = TextDrawCreate(471.000000,349.000000,string1);
	TextDrawBackgroundColor(TextLevel,COLOR_GREEN);
	TextDrawLetterSize(TextLevel,0.699999,1.600000);
	TextDrawBackgroundColor(TextLevel,0x000000ff);
	TextDrawSetProportional(TextLevel,1);
	TextDrawColor(TextLevel,0xffffffff);
	TextDrawSetShadow(TextLevel,1);
	TextDrawFont(TextLevel,3);
	TextDrawAlignment(TextLevel,0);
	TextDrawSetOutline(TextLevel,1);

	TextKills = TextDrawCreate(471.000000,373.000000,string2);
	TextDrawBackgroundColor(TextKills,COLOR_GREEN);
	TextDrawLetterSize(TextKills,0.699999,1.600000);
	TextDrawBackgroundColor(TextKills,0x000000ff);
	TextDrawSetProportional(TextKills,1);
	TextDrawColor(TextKills,0xffffffff);
	TextDrawSetShadow(TextKills,1);
	TextDrawFont(TextKills,3);
	TextDrawAlignment(TextKills,0);
	TextDrawSetOutline(TextKills,1);

	TextBank = TextDrawCreate(471.000000,395.000000,string3);
	TextDrawBackgroundColor(TextBank,COLOR_GREEN);
	TextDrawAlignment(TextBank,0);
	TextDrawBackgroundColor(TextBank,0x000000ff);
	TextDrawFont(TextBank,3);
	TextDrawLetterSize(TextBank,0.699999,1.600000);
	TextDrawColor(TextBank,0xffffffff);
	TextDrawSetOutline(TextBank,1);
	TextDrawSetProportional(TextBank,1);
	TextDrawSetShadow(TextBank,1);
	TextDrawAlignment(TextKills,0);
	return 1;
}
someone help please

sorry for bad English
Reply
#2

Must be
Код:
new Text:TextLevel[200];
new Text:TextKills[200];
new Text:TextBank[200];
Код:
TextDrawShowForPlayer(playerid,TextLevel[playerid]);
TextDrawShowForPlayer(playerid,TextKills[playerid]);
TextDrawShowForPlayer(playerid,TextBank[playerid]);
hide too

Код:
format(string1,sizeof(string1),"Level: %d",PlayerInfo[i][Level]);
TextDrawSetString(TextLevel[i],string1);
format(string2,sizeof(string2),"Kills: %d",PlayerInfo[i][Kills]);
TextDrawSetString(TextKills[i],string2);
format(string3,sizeof(string3),"Bank: %d",PlayerInfo[i][Bank]);
TextDrawSetString(TextBank[i],string3);
and create must be too [playerid] and why 3 textdraws? xD
Reply
#3

Quote:
Originally Posted by Jefff
Must be
Код:
new Text:TextLevel[200];
new Text:TextKills[200];
new Text:TextBank[200];
Код:
TextDrawShowForPlayer(playerid,TextLevel[playerid]);
TextDrawShowForPlayer(playerid,TextKills[playerid]);
TextDrawShowForPlayer(playerid,TextBank[playerid]);
hide too

Код:
format(string1,sizeof(string1),"Level: %d",PlayerInfo[i][Level]);
TextDrawSetString(TextLevel[i],string1);
format(string2,sizeof(string2),"Kills: %d",PlayerInfo[i][Kills]);
TextDrawSetString(TextKills[i],string2);
format(string3,sizeof(string3),"Bank: %d",PlayerInfo[i][Bank]);
TextDrawSetString(TextBank[i],string3);
and create must be too [playerid] and why 3 textdraws? xD
i have a lot of error

Код:
error 033: array must be indexed (variable "TextLevel")
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
: error 033: array must be indexed (variable "TextKills")
: error 035: argument type mismatch (argument 1)
: error 035: argument type mismatch (argument 1)
: error 035: argument type mismatch (argument 1)
: error 035: argument type mismatch (argument 1)
: error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
error 033: array must be indexed (variable "TextBank")
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
 error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
all this error about this:
Код:
TextLevel = TextDrawCreate(471.000000,349.000000,string1);
	TextDrawBackgroundColor(TextLevel,COLOR_GREEN);
	TextDrawLetterSize(TextLevel,0.699999,1.600000);
	TextDrawBackgroundColor(TextLevel,0x000000ff);
	TextDrawSetProportional(TextLevel,1);
	TextDrawColor(TextLevel,0xffffffff);
	TextDrawSetShadow(TextLevel,1);
	TextDrawFont(TextLevel,3);
	TextDrawAlignment(TextLevel,0);
	TextDrawSetOutline(TextLevel,1);

	TextKills = TextDrawCreate(471.000000,373.000000,string2);
	TextDrawBackgroundColor(TextKills,COLOR_GREEN);
	TextDrawLetterSize(TextKills,0.699999,1.600000);
	TextDrawBackgroundColor(TextKills,0x000000ff);
	TextDrawSetProportional(TextKills,1);
	TextDrawColor(TextKills,0xffffffff);
	TextDrawSetShadow(TextKills,1);
	TextDrawFont(TextKills,3);
	TextDrawAlignment(TextKills,0);
	TextDrawSetOutline(TextKills,1);

	TextBank = TextDrawCreate(471.000000,395.000000,string3);
	TextDrawBackgroundColor(TextBank,COLOR_GREEN);
	TextDrawAlignment(TextBank,0);
	TextDrawBackgroundColor(TextBank,0x000000ff);
	TextDrawFont(TextBank,3);
	TextDrawLetterSize(TextBank,0.699999,1.600000);
	TextDrawColor(TextBank,0xffffffff);
	TextDrawSetOutline(TextBank,1);
	TextDrawSetProportional(TextBank,1);
	TextDrawSetShadow(TextBank,1);
	TextDrawAlignment(TextKills,0);
someone help?
Reply
#4

Quote:
Originally Posted by Jefff
and create must be too [playerid] and why 3 textdraws? xD
TextLevel[playerid] = TextDrawCreate...
etc with
Код:
[playerid]
Reply
#5

Quote:
Originally Posted by Jefff
Quote:
Originally Posted by Jefff
and create must be too [playerid] and why 3 textdraws? xD
TextLevel[playerid] = TextDrawCreate...
etc with
Код:
[playerid]
Код:
error 028: invalid subscript (not an array or too many subscripts): "TextLevel"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
line 1183:
Код:
			TextDrawShowForPlayer(playerid,TextLevel[playerid]);
Reply
#6

look here
http://forum.sa-mp.com/index.php?topic=87351.0
Reply
#7

ok it's work i fine my bug

how i do that the textdraw always be on? because i turn on the textdraw with the command /showstats
Reply
#8

Remove the timer or learn PAWNO.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)