\n not working in my script
#1

So, to practice pawno, I'm trying to make a rather weird mimic of Convoy Trucking, if anyone knows that server, and I've been stumped on a problem.

I removed the health bar and added the name but I also tried adding the Transport Tycoon label under the name, but it just doesnt appear. This is the code I use to do it.

Код:
format(string, sizeof(string), "%s\nTransport Tycoon", pname);
    new Text3D:label2 = Create3DTextLabel(pname, 0xFFFF00FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label2, playerid, 0.0, 0.0, 0.2);
Expert scripters I know say they see no problems in it, but it just wont work for me. I've spend all Christmas break looking for a solution (waste of time huh?) only to no avail, no solution.

Please help.
Reply
#2

You are passing "pname" as the text parameter instead of the intended variable, "string".
pawn Код:
new Text3D:label2 = Create3DTextLabel(string, 0xFFFF00FF, 30.0, 40.0, 50.0, 40.0, 0);
Reply
#3

I'll try it out. Thanks for the quick reply.
Reply
#4

Thanks. It worked. but I got one more weird request, please bear with me.

I wanna make a command called /setcustomrank, like in CVT, it changes the rank from Transport Tycoon to whatever the player types in. You got any ideas oh wise one?
Reply
#5

and please help me
how to add rules and command?
Reply
#6

Thanks. It worked. but I got one more weird request, please bear with me.

I wanna make a command called /setcustomrank, like in CVT, it changes the rank from Transport Tycoon to whatever the player types in. You got any ideas oh wise one?
Reply
#7

Quote:
Originally Posted by roryprayana
Посмотреть сообщение
and please help me
how to add rules and command?
Uh, to add commands, search for OnPlayerCommandText.

You replace /mycommand with the name of the command you want to make. And the rest? Well you'll have to have SOME knowledge of pawno scripting.

Simple /heal command:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100)
		SendClientMessage(playerid, COLOR_YELLOW, "You have been healed);
		return 1;
	}
Reply
#8

Quote:
Originally Posted by Calvingreen17
Посмотреть сообщение
Well you'll have to have SOME knowledge of pawno scripting.
It is Pawn, pawno is the compiler.

And please, don't double post just use the edit button.
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
It is Pawn, pawno is the compiler.

And please, don't double post just use the edit button.
It wasnt my fault. I temporarily lost connection and somehow it double posted. I tried deleting it but found no option.

EDIT:

Oh, and my bad, Pawn scripting lol.

EDIT again:

So, I went ahead and tried to make my own /setcustomrank command:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/setcustomrank", cmdtext, true, 10) == 0)
	{
        new str[128];
        format(str, sizeof(str), "%s\n%s", str, cmdtext);
        new Text3D:label3 = Create3DTextLabel(str, 0xFFFF00FF, 30.0, 40.0, 50.0, 40.0, 0);
    	Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.2);
    	SendClientMessage(playerid, 0x33AA33AA, "You have set your rank to %s");
		return 1;
	}
	return 0;
}
It causes the server to crash whenever I use it. Help D:
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)