SA-MP Forums Archive
Using strcat but getting errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using strcat but getting errors (/showthread.php?tid=369745)



Using strcat but getting errors - HydraX - 18.08.2012

I know, I've been posting a lot lately, but I'm trying to be as precautions as possible.

pawn Код:
new
        string[800],
        string1[40];
    format(string1,sizeof(string1),"%s stats",GetName(clickedplayerid));

    strcat(string, "{CCFF00}%s{FFFFFF} currently has {33FF00}%d{FFFFFF} Kills and {FF0000}%d{FFFFFF} Deaths \nwhich averages to {FFFF66}%0.2f{FFFFFF} kills per every death. ", GetName(clickedplayerid),kills,deaths, Float:kills/Float:deaths);
    strcat(string, "\n{CCFF00}%s{FFFFFF} is {00FFCC}%s{FFFFFF} with a {00FFCC}%s{FFFFFF}\n%s currently has {33CC00}$%d{FFFFFF} in his pocket.", GetName(clickedplayerid),AdmRank,AccType,GetName(clickedplayerid), cash);
    strcat(string, "\n\tHe also has a total of {00CCFF}%d{FFFFFF} points\n\t%s\n\t%s\n\t%s\nHis internet connection is currently registered at %d ms ", score, Jailed, Muted, Caged, GetPlayerPing(clickedplayerid));
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string1, string, "Close", ""); //Shows dialog with admins, one button "Close"
error 035: argument type mismatch (argument 3)
error 035: argument type mismatch (argument 3)
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 204: symbol is assigned a value that is never used: "cash"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Before making that. I tried this.

pawn Код:
string[800],
        string1[40];
    format(string1,sizeof(string1),"%s stats",GetName(clickedplayerid));
    format(string, 550, "{CCFF00}%s{FFFFFF} currently has {33FF00}%d{FFFFFF} Kills and {FF0000}%d{FFFFFF} Deaths \nwhich averages to {FFFF66}%0.2f{FFFFFF} kills per every death. ", GetName(clickedplayerid),kills,deaths, Float:kills/Float:deaths);
    format(string, 550, "\n{CCFF00}%s{FFFFFF} is {00FFCC}%s{FFFFFF} with a {00FFCC}%s{FFFFFF}\n%s currently has {33CC00}$%d{FFFFFF} in his pocket.", GetName(clickedplayerid),AdmRank,AccType,GetName(clickedplayerid), cash);
    format(string, 550, "\n\tHe also has a total of {00CCFF}%d{FFFFFF} points\n\t%s\n\t%s\n\t%s\nHis internet connection is currently registered at %d ms ", score, Jailed, Muted, Caged, GetPlayerPing(clickedplayerid));
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string1, string, "Close", ""); //Shows dialog with admins, one button "Close"
However, even though it complied without error, I realised that this would only show the bottom part of the string, and ignore the 2 above.


Respuesta: Using strcat but getting errors - HydraX - 18.08.2012

Can't seem to edit my OP for some reason.
This is the 2 snippet, that complied correctly but only show the bottom part of the string.



Re: Using strcat but getting errors - Ballu Miaa - 18.08.2012

Even i want to do something like this and can not do. Yeah people any suggestions for us?
to use strcat with the variables?


Respuesta: Using strcat but getting errors - HydraX - 18.08.2012

I think strcat, unfortunately, only works when you split a string, from, let's say, /teleport, where you only need to split words inside a string, but when you include variables, I don't think it supports it.

Format() works, but will only show the last string issued, leaving all on top ignored and not used.


Re: Using strcat but getting errors - Ballu Miaa - 18.08.2012

Strcat() joins two strings together. But yes i dont think that it support's variables like format.

So what is the alternative for format()?


Respuesta: Using strcat but getting errors - HydraX - 18.08.2012

I don't know. There may be a work around, but that's where the known scripters come in.


Respuesta: Using strcat but getting errors - HydraX - 18.08.2012

Pretty unfortunate that there seems to be no work around, I guess the only solution is to reduce how I type.


Re: Respuesta: Using strcat but getting errors - Ballu Miaa - 18.08.2012

Quote:
Originally Posted by HydraX
Посмотреть сообщение
Pretty unfortunate that there seems to be no work around, I guess the only solution is to reduce how I type.
I tried doing that. In My script that doesnt help.

So yeah im still looking for someone who actually knows what to do here?