Problem with string - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with string (
/showthread.php?tid=167178)
[SOLVED] Problem with string -
Sascha - 11.08.2010
the problem is on the Owner %s it doesn't show the name... it only shows "Owner: ||"
Код:
new string[256], id, slots, name[256];
name = dini_Int(dat, "Name");
id = dini_Int(dat, "ID");
slots = dini_Int(dat, "Slots");
format(string, sizeof(string), "Owner: %s || Vehicle Slots: %d || House ID: %d", name, slots, id);
SendClientMessage(playerid, ORANGE, string);
Re: Problem with string -
Vince - 11.08.2010
You cannot assign a value to a string with '='. You need to use format or strmid with it.
And while we're at it, you might want to read this topic as-well:
https://sampforum.blast.hk/showthread.php?tid=55261
Re: Problem with string -
Sascha - 11.08.2010
so how to fix it?...
Код:
new string[256], id, slots, name[20];
format(name, sizeof(name), "%s", dini_Int(dat, "Name"));
id = dini_Int(dat, "ID");
slots = dini_Int(dat, "Slots");
format(string, sizeof(string), "Owner: %s || Vehicle Slots: %d || House ID: %d", name, slots, id);
SendClientMessage(playerid, ORANGE, string);
that works neither... however I guess what I just did was kinda stupid...
Re: Problem with string -
ivex - 11.08.2010
Quote:
Originally Posted by Sascha
so how to fix it?...
Код:
new string[256], id, slots, name[20];
format(name, sizeof(name), "%s", dini_Int(dat, "Name"));
id = dini_Int(dat, "ID");
slots = dini_Int(dat, "Slots");
format(string, sizeof(string), "Owner: %s || Vehicle Slots: %d || House ID: %d", name, slots, id);
SendClientMessage(playerid, ORANGE, string);
that works neither... however I guess what I just did was kinda stupid...
|
Yes you need to use strmid + for strings use "dini_get " not "dini_int"..