Argument type mistmach 2
#1

Код:
new PlayerText3D: teks[MAX_PLAYERS], Float: Pos[3], texxt;
	    if(sscanf(params, "s[32]", texxt)) return SendClientMessage(playerid, WHITE, "USAGE:/txt [text]");
		if(texxt <= 3 || texxt >= 20)
		{
	    	GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  			teks[playerid] = CreatePlayer3DTextLabel(playerid, texxt, 0x33AA33AA, Pos[0], Pos[1], Pos[2]+2, 15.0, playerid, INVALID_VEHICLE_ID);
  			return 1;
		}
Whats the problem here?!
Reply
#2

pawn Код:
new PlayerText3D: teks[MAX_PLAYERS], Float: Pos[3], texxt[32];
texxt needs to be a string

and what do you want to check here?
pawn Код:
if(texxt <= 3 || texxt >= 20)

or if that should be a number and not a texxt, change this
pawn Код:
if(sscanf(params, "s[32]", texxt))
to this:
pawn Код:
if(sscanf(params, "i", texxt))
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
new PlayerText3D: teks[MAX_PLAYERS], Float: Pos[3], texxt[32];
texxt needs to be a string

and what do you want to check here?
pawn Код:
if(texxt <= 3 || texxt >= 20)

or if that should be a number and not a texxt, change this
pawn Код:
if(sscanf(params, "s[32]", texxt))
to this:
pawn Код:
if(sscanf(params, "i", texxt))
if(texxt <= 3 || texxt >= 20)

here i check the length of the text, cuz if u type nothing will crash the server.
Reply
#4

pawn Код:
new PlayerText3D: teks[MAX_PLAYERS], Float: Pos[3], texxt[32];
if(sscanf(params, "s[32]", texxt)) return SendClientMessage(playerid, WHITE, "USAGE:/txt [text]");
if(strlen(texxt) <= 3 || strlen(texxt) >= 20)
{
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    teks[playerid] = CreatePlayer3DTextLabel(playerid, texxt, 0x33AA33AA, Pos[0], Pos[1], Pos[2]+2, 15.0, playerid, INVALID_VEHICLE_ID);
    return 1;
}
although as texxt is a string variable now, it should return the Useage message if the length is = 0 now, so you can leave that if(strlen(texxt) ...) part away

the length of a string is checked by "strlen()" btw
https://sampwiki.blast.hk/wiki/Strlen
Reply
#5

Thanks. REP added : )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)