TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
Hi,
I've got problems with creating Textdraws in cyclus...
There is code:
Код HTML:
#include <a_samp>
#define MAX_TXDS 2
#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
new Text: TD_MM_HLBUDOVA;
enum TextDraws_
{
Text:textid,
Float:pos_x,
Float:pos_y,
nameofTEXT[68],
Float:letter_x,
Float:letter_y,
Float:textsiz_x,
Float:textsiz_y,
align,
col,
shad,
outl,
bckgrocol,
font,
propo,
bool:select
}
new TextCreates[MAX_TXDS][TextDraws_] =
{
{ TD_MM_HLBUDOVA, 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true },//47
{ TD_MM_HLBUDOVA, 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true }
};//49
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(test, 4, cmdtext);
return 0;
}
dcmd_test(playerid, params[])
{
#pragma unused params
#pragma unused playerid
for(new i=0;i<=MAX_TXDS;i++)
{
TextCreates[i][textid] = TextDrawCreate(TextCreates[i][pos_x], TextCreates[i][pos_y], TextCreates[i][nameofTEXT]);
TextDrawLetterSize(TextCreates[i][textid], TextCreates[i][letter_x],TextCreates[i][letter_y]);
TextDrawTextSize(TextCreates[i][textid], TextCreates[i][textsiz_x],TextCreates[i][textsiz_y]);
TextDrawAlignment(TextCreates[i][textid], TextCreates[i][align]);
TextDrawColor(TextCreates[i][textid], TextCreates[i][col]);
TextDrawSetShadow(TextCreates[i][textid], TextCreates[i][shad]);
TextDrawSetOutline(TextCreates[i][textid], TextCreates[i][outl]);
TextDrawBackgroundColor(TextCreates[i][textid], TextCreates[i][bckgrocol]);
TextDrawFont(TextCreates[i][textid], TextCreates[i][font]);
TextDrawSetProportional(TextCreates[i][textid], TextCreates[i][propo]);
TextDrawSetSelectable(TextCreates[i][textid], TextCreates[i][select]);
}
return 1;
}
And errors:
Код HTML:
C:\Users\Radek\Desktop\test_txd.pwn(47) : error 008: must be a constant expression; assumed zero
C:\Users\Radek\Desktop\test_txd.pwn(49) : error 010: invalid function or declaration
C:\Users\Radek\Desktop\test_txd.pwn(393) : warning 203: symbol is never used: ""
393 - not exist...
Thank you.
Re: TextDrawCreate in cycles -
AroseKhanNiazi - 20.10.2014
try this
pawn Код:
#include <a_samp>
#define MAX_TXDS 2
#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
new Text:textid[MAX_TXDS];
enum TextDraws_
{
Float:pos_x,
Float:pos_y,
nameofTEXT[68],
Float:letter_x,
Float:letter_y,
Float:textsiz_x,
Float:textsiz_y,
align,
col,
shad,
outl,
bckgrocol,
font,
propo,
bool:select
}
new TextCreates[MAX_TXDS][TextDraws_] =
{
{ 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true },//47
{ 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true }
};//49
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(test, 4, cmdtext);
return 0;
}
dcmd_test(playerid, params[])
{
#pragma unused params
#pragma unused playerid
for(new i=0;i<=MAX_TXDS;i++)
{
textid[i] = TextDrawCreate(TextCreates[i][pos_x], TextCreates[i][pos_y], TextCreates[i][nameofTEXT]);
TextDrawLetterSize(TextCreates[i][textid], TextCreates[i][letter_x],TextCreates[i][letter_y]);
TextDrawTextSize(TextCreates[i][textid], TextCreates[i][textsiz_x],TextCreates[i][textsiz_y]);
TextDrawAlignment(TextCreates[i][textid], TextCreates[i][align]);
TextDrawColor(TextCreates[i][textid], TextCreates[i][col]);
TextDrawSetShadow(TextCreates[i][textid], TextCreates[i][shad]);
TextDrawSetOutline(TextCreates[i][textid], TextCreates[i][outl]);
TextDrawBackgroundColor(TextCreates[i][textid], TextCreates[i][bckgrocol]);
TextDrawFont(TextCreates[i][textid], TextCreates[i][font]);
TextDrawSetProportional(TextCreates[i][textid], TextCreates[i][propo]);
TextDrawSetSelectable(TextCreates[i][textid], TextCreates[i][select]);
}
return 1;
}
and suggestion try using zcmd its better
Re: TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
textid doing problems...
Errors:
Код HTML:
C:\Users\Radek\Desktop\test_txd.pwn(47) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(48) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(49) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(50) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(51) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(52) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(53) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(54) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(55) : error 033: array must be indexed (variable "textid")
C:\Users\Radek\Desktop\test_txd.pwn(56) : error 033: array must be indexed (variable "textid")
So... next ideas ?
Re: TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
Wait... I found problem... "textid[i]" must be everywhere
I'll test it and write there...
Re: TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
Ok. I tested it, and there is code:
Код HTML:
#include <a_samp>
#define MAX_TXDS 2
#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
new Text:textid[MAX_TXDS];
enum TextDraws_
{
Float:pos_x,
Float:pos_y,
nameofTEXT[68],
Float:letter_x,
Float:letter_y,
Float:textsiz_x,
Float:textsiz_y,
align,
col,
shad,
outl,
bckgrocol,
font,
propo,
bool:select
}
new TextCreates[MAX_TXDS][TextDraws_] =
{
{ 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true },//47
{ 70.599979, 200.293395, "Hlavni budova 2", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true }
};//49
public OnGameModeInit()
{
SetGameModeText("ahoj");
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(test, 4, cmdtext);
return 0;
}
dcmd_test(playerid, params[])
{
#pragma unused params
#pragma unused playerid
for(new i=0;i<=MAX_TXDS;i++)
{
textid[i] = TextDrawCreate(TextCreates[i][pos_x], TextCreates[i][pos_y], TextCreates[i][nameofTEXT]);
TextDrawLetterSize(textid[i], TextCreates[i][letter_x],TextCreates[i][letter_y]);
TextDrawTextSize(textid[i], TextCreates[i][textsiz_x],TextCreates[i][textsiz_y]);
TextDrawAlignment(textid[i], TextCreates[i][align]);
TextDrawColor(textid[i], TextCreates[i][col]);
TextDrawSetShadow(textid[i], TextCreates[i][shad]);
TextDrawSetOutline(textid[i], TextCreates[i][outl]);
TextDrawBackgroundColor(textid[i], TextCreates[i][bckgrocol]);
TextDrawFont(textid[i], TextCreates[i][font]);
TextDrawSetProportional(textid[i], TextCreates[i][propo]);
TextDrawSetSelectable(textid[i], TextCreates[i][select]);
}
return 1;
}
But if I use command, server write to me: "SERVER: Unknown command" - problem is cyklus ?
Re: TextDrawCreate in cycles -
AroseKhanNiazi - 20.10.2014
oh ye sorry lol idk how i missed it

edit sorry i posted double post kindly remove this post
Re: TextDrawCreate in cycles -
AroseKhanNiazi - 20.10.2014
can u try this i am not sure of dcmd never worked with it
pawn Код:
#include <a_samp>
#include <zcmds>
#define MAX_TXDS 2
new Text:textid[MAX_TXDS];
enum TextDraws_
{
Float:pos_x,
Float:pos_y,
nameofTEXT[68],
Float:letter_x,
Float:letter_y,
Float:textsiz_x,
Float:textsiz_y,
align,
col,
shad,
outl,
bckgrocol,
font,
propo,
bool:select
}
new TextCreates[MAX_TXDS][TextDraws_] =
{
{ 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true },//47
{ 70.599979, 200.293395, "Hlavni budova 2", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 51, 1, 1, true }
};//49
public OnGameModeInit()
{
SetGameModeText("ahoj");
return 1;
}
public OnGameModeExit()
{
return 1;
}
CMD:test(playerid)
{
for(new i=0;i<=MAX_TXDS;i++)
{
textid[i] = TextDrawCreate(TextCreates[i][pos_x], TextCreates[i][pos_y], TextCreates[i][nameofTEXT]);
TextDrawLetterSize(textid[i], TextCreates[i][letter_x],TextCreates[i][letter_y]);
TextDrawTextSize(textid[i], TextCreates[i][textsiz_x],TextCreates[i][textsiz_y]);
TextDrawAlignment(textid[i], TextCreates[i][align]);
TextDrawColor(textid[i], TextCreates[i][col]);
TextDrawSetShadow(textid[i], TextCreates[i][shad]);
TextDrawSetOutline(textid[i], TextCreates[i][outl]);
TextDrawBackgroundColor(textid[i], TextCreates[i][bckgrocol]);
TextDrawFont(textid[i], TextCreates[i][font]);
TextDrawSetProportional(textid[i], TextCreates[i][propo]);
TextDrawSetSelectable(textid[i], TextCreates[i][select]);
}
return 1;
}
Re: TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
I tried with:
DCMD - not working (command is working, but server said me "error")
normal commands - from "pawno.exe" - not working (command is working, but server said me "error")
ZCMD - not working (command is working, but server said me "error")
Re: TextDrawCreate in cycles -
AroseKhanNiazi - 20.10.2014
OKAY NOW command works
pawn Код:
#include <a_samp>
#include <zcmd>
#define MAX_TXDS 2
main() {}
new Text:textid[MAX_TXDS];
enum TextDraws_
{
Float:pos_x,
Float:pos_y,
nameofTEXT[68],
Float:letter_x,
Float:letter_y,
Float:textsiz_x,
Float:textsiz_y,
align,
col,
shad,
outl,
bckgrocol,
font,
propo,
bool:select
}
new TextCreates[MAX_TXDS][TextDraws_] =
{
{ 49.599979, 158.293395, "Hlavni budova", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 55, 1, 1, true },//47
{ 70.599979, 200.293395, "Hlavni budova 2", 0.311599, 1.301333, 128.000, 15.0000, 1, -1, 0, 1, 55, 1, 1, true }
};//49
public OnGameModeInit()
{
SetGameModeText("ahoj");
return 1;
}
public OnGameModeExit()
{
return 1;
}
CMD:test(playerid)
{
for(new i=0; i < MAX_TXDS;i++)
{
textid[i] = TextDrawCreate(TextCreates[i][pos_x], TextCreates[i][pos_y], TextCreates[i][nameofTEXT]);
TextDrawLetterSize(textid[i], TextCreates[i][letter_x],TextCreates[i][letter_y]);
TextDrawTextSize(textid[i], TextCreates[i][textsiz_x],TextCreates[i][textsiz_y]);
TextDrawAlignment(textid[i], TextCreates[i][align]);
TextDrawColor(textid[i], TextCreates[i][col]);
TextDrawSetShadow(textid[i], TextCreates[i][shad]);
TextDrawSetOutline(textid[i], TextCreates[i][outl]);
TextDrawBackgroundColor(textid[i], TextCreates[i][bckgrocol]);
TextDrawFont(textid[i], TextCreates[i][font]);
TextDrawSetProportional(textid[i], TextCreates[i][propo]);
TextDrawSetSelectable(textid[i], TextCreates[i][select]);
}
return 1;
}
Re: TextDrawCreate in cycles -
TheRohlikar - 20.10.2014
Yes, I found it too
But really thank you !