Textdraw string.
#1

So, I'm just scripting to evolve my skills, doing some stuff with textdraws. And, these *BEEP* errors, making me go nuts:

Код:
C:\Documents and Settings\Admin\Desktop\Testing GM\gamemodes\testing.pwn(5592) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Admin\Desktop\Testing GM\gamemodes\testing.pwn(5592) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Admin\Desktop\Testing GM\gamemodes\testing.pwn(5596) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Admin\Desktop\Testing GM\gamemodes\testing.pwn(33423) : warning 203: symbol is never used: "GetPointDistanceToPointExMorph"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
**Ignore the warning.
And this is the *BEEP* code:
pawn Код:
public LicnaKarta(playerid,targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new name[MAX_PLAYER_NAME];
        new otext[20];
        new atext[20];
        new age = PlayerInfo[targetid][pAge];
        GetPlayerName(targetid, name, sizeof(name));
        if(PlayerInfo[targetid][pOrigin] == 1) { otext = "Hrvatska"; }
        else if(PlayerInfo[targetid][pOrigin] == 2) { otext = "Bosna"; }
        else if(PlayerInfo[targetid][pOrigin] == 3) { otext = "CrnaGora"; }
        else if(PlayerInfo[targetid][pOrigin] == 4) { otext = "Srbija"; }
        if(PlayerInfo[targetid][pSex] == 1) { atext = "Musko"; }
        else if(PlayerInfo[targetid][pSex] == 2) { atext = "Zensko"; }
        format(name, sizeof(name), "%s", name);
        format(otext, sizeof(otext), "%s", otext);
        format(atext, sizeof(atext), "%s", atext);
        format(age, sizeof(age), "%d", age);
        TextDrawSetString(Licnakarta4, name);
        TextDrawSetString(Licnakarta7, otext);
        TextDrawSetString(Licnakarta12, atext);
        TextDrawSetString(Licnakarta13, age);
        TextDrawShowForPlayer(playerid, Licnakarta4);
        TextDrawShowForPlayer(playerid, Licnakarta7);
        TextDrawShowForPlayer(playerid, Licnakarta12);
        TextDrawShowForPlayer(playerid, Licnakarta13);
        //----------------Prodolzuva----------------//
        TextDrawShowForPlayer(playerid, Licnakarta0);
        TextDrawShowForPlayer(playerid, Licnakarta1);
        TextDrawShowForPlayer(playerid, Licnakarta2);
        TextDrawShowForPlayer(playerid, Licnakarta3);
        TextDrawShowForPlayer(playerid, Licnakarta5);
        TextDrawShowForPlayer(playerid, Licnakarta6);
        TextDrawShowForPlayer(playerid, Licnakarta8);
        TextDrawShowForPlayer(playerid, Licnakarta9);
        TextDrawShowForPlayer(playerid, Licnakarta10);
        TextDrawShowForPlayer(playerid, Licnakarta11);
        TextDrawShowForPlayer(playerid, Licnakarta14);
        TextDrawShowForPlayer(playerid, Licnakarta15);
        TextDrawShowForPlayer(playerid, Licnakarta16);
        TextDrawShowForPlayer(playerid, Licnakarta17);
        TextDrawShowForPlayer(playerid, Licnakarta18);
        TextDrawShowForPlayer(playerid, Licnakarta19);
        TextDrawShowForPlayer(playerid, Licnakarta20);
    }
}
And the *BEEP* lines:
pawn Код:
Error 5592:
format(age, sizeof(age), "%d", age);

Error 5596:
TextDrawSetString(Licnakarta13, age);
Any explaining what I'm doing wrong?

EDIT:

Thought of removing the formatting, but In the end I got this:

pawn Код:
public LicnaKarta(playerid,targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new name[MAX_PLAYER_NAME];
        new otext[20];
        new atext[20];
        new age = PlayerInfo[targetid][pAge];
        GetPlayerName(targetid, name, sizeof(name));
        if(PlayerInfo[targetid][pOrigin] == 1) { otext = "Hrvatska"; }
        else if(PlayerInfo[targetid][pOrigin] == 2) { otext = "Bosna"; }
        else if(PlayerInfo[targetid][pOrigin] == 3) { otext = "CrnaGora"; }
        else if(PlayerInfo[targetid][pOrigin] == 4) { otext = "Srbija"; }
        if(PlayerInfo[targetid][pSex] == 1) { atext = "Musko"; }
        else if(PlayerInfo[targetid][pSex] == 2) { atext = "Zensko"; }
        TextDrawSetString(Licnakarta4, name);
        TextDrawSetString(Licnakarta7, otext);
        TextDrawSetString(Licnakarta12, atext);
        TextDrawSetString(Licnakarta13, age);
        TextDrawShowForPlayer(playerid, Licnakarta4);
        TextDrawShowForPlayer(playerid, Licnakarta7);
        TextDrawShowForPlayer(playerid, Licnakarta12);
        TextDrawShowForPlayer(playerid, Licnakarta13);
        //----------------Prodolzuva----------------//
        TextDrawShowForPlayer(playerid, Licnakarta0);
        TextDrawShowForPlayer(playerid, Licnakarta1);
        TextDrawShowForPlayer(playerid, Licnakarta2);
        TextDrawShowForPlayer(playerid, Licnakarta3);
        TextDrawShowForPlayer(playerid, Licnakarta5);
        TextDrawShowForPlayer(playerid, Licnakarta6);
        TextDrawShowForPlayer(playerid, Licnakarta8);
        TextDrawShowForPlayer(playerid, Licnakarta9);
        TextDrawShowForPlayer(playerid, Licnakarta10);
        TextDrawShowForPlayer(playerid, Licnakarta11);
        TextDrawShowForPlayer(playerid, Licnakarta14);
        TextDrawShowForPlayer(playerid, Licnakarta15);
        TextDrawShowForPlayer(playerid, Licnakarta16);
        TextDrawShowForPlayer(playerid, Licnakarta17);
        TextDrawShowForPlayer(playerid, Licnakarta18);
        TextDrawShowForPlayer(playerid, Licnakarta19);
        TextDrawShowForPlayer(playerid, Licnakarta20);
    }
}
I get this:
Код:
C:\Documents and Settings\Admin\Desktop\DreamWorld RPG Macedonia 0.3d\gamemodes\DREAMWORLD.pwn(5592) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Admin\Desktop\DreamWorld RPG Macedonia 0.3d\gamemodes\DREAMWORLD.pwn(5581) : warning 204: symbol is assigned a value that is never used: "age"
C:\Documents and Settings\Admin\Desktop\DreamWorld RPG Macedonia 0.3d\gamemodes\DREAMWORLD.pwn(33419) : warning 203: symbol is never used: "GetPointDistanceToPointExMorph"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.

Line 5592:
TextDrawSetString(Licnakarta13, age);
Line 5581:
new age = PlayerInfo[targetid][pAge];
Reply
#2

(( Replying on the EDIT 2 you made ))

I think the problem is the 'new'. Try using this:

pawn Код:
new age;
age = PlayerInfo[targetid][pAge];

TextDrawSetString(Licnakarta13, age);
I hope that will fix the problem.

EDIT: What I did? Just don't use the PlayerInfo in when you're making 'new age = x', make the 'new' first (( 'new age;' )) then you must use it below, that's why you got the warning also.
Reply
#3

No luck.
Reply
#4

pawn Код:
new szAge[12];

format(szAge, sizeof (szAge), "%d", PlayerInfo[targetid][pAge]);

TextDrawSetString(Licnakarta13, szAge);
Reply
#5

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
pawn Код:
new szAge[12];

format(szAge, sizeof (szAge), "%d", PlayerInfo[targetid][pAge]);

TextDrawSetString(Licnakarta13, szAge);
You sir are a genius! Here you go, a prize:
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)