[Help] Problems with ingame setmapicon
#1

Hey Samp forum.
-I've tried 2 different ways to make a command like /setmapicon
and then it saves the pos, iconid and markertype in a file. when a player login then he should load the file aka. he should load the icons. but i've failled.
i made one there was 666 lines long and now i had to delete it..
Hellfire gave me this:

pawn Код:
CMD:setmapicon(playerid, params[])
{
    new ID, Type, string[128];
    if(sscanf(params, "dd", ID, Type)) ERRORMSG(playerid, "[WR Usage]: /setmapicon <Iconid> <Marker Type>");
    else if(IDused[ID] == true)
    {
      format(string, sizeof(string), "[WR Server]: That iconid is in use! try %i+1", ID);
        ERRORMSG(playerid, string);
    }
    else
    {
        new Float:Loc[3];
        new idstr[3];
        format(idstr, 3, "%d", ID);
        GetPlayerPos(playerid, Loc[0], Loc[1], Loc[2]);
        dini_Set("Icons", idstr, "SetPlayerMapIcon(playerid, %d, %f, %f, %f, %d, 0)" ID, Loc[0], Loc[1], Loc[2], Type);
    }
    return 1;
}
but it has some errors.
Anyone got a easy way to make this command so it saves and loads?
Reply
#2

Quote:
Originally Posted by Niixie
Hey Samp forum.
-I've tried 2 different ways to make a command like /setmapicon
and then it saves the pos, iconid and markertype in a file. when a player login then he should load the file aka. he should load the icons. but i've failled.
i made one there was 666 lines long and now i had to delete it..
Hellfire gave me this:

pawn Код:
CMD:setmapicon(playerid, params[])
{
    new ID, Type, string[128];
    if(sscanf(params, "dd", ID, Type)) ERRORMSG(playerid, "[WR Usage]: /setmapicon <Iconid> <Marker Type>");
    else if(IDused[ID] == true)
    {
      format(string, sizeof(string), "[WR Server]: That iconid is in use! try %i+1", ID);
        ERRORMSG(playerid, string);
    }
    else
    {
        new Float:Loc[3];
        new idstr[3];
        format(idstr, 3, "%d", ID);
        GetPlayerPos(playerid, Loc[0], Loc[1], Loc[2]);
        dini_Set("Icons", idstr, "SetPlayerMapIcon(playerid, %d, %f, %f, %f, %d, 0)" ID, Loc[0], Loc[1], Loc[2], Type);
    }
    return 1;
}
but it has some errors.
Anyone got a easy way to make this command so it saves and loads?
Reply
#3

Bump?
Reply
#4

Код:
if(!strcmp(cmdtext,"/mapsave",true,8))
{
	if(!cmd[10])return SendClientMessage(playerid,0xFF0000FF,"Use /mapsave [markertyp]");
	new Float:pos[3];
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	new File:iox = fopen("markers.txt",io_append);
	new fmstr[128];
	format(fmstr,sizeof fmstr,"SetPlayerMapIcon(playerid,iconid,%f,%f,%f,%d,0);\r\n",
	pos[0],pos[1],pos[2],strval(cmdtext[10]));
	fwrite(iox,fmstr);
	fclose(iox);	
	return 1;
}
Reply
#5

Quote:
Originally Posted by BlackFoX_UD_
Код:
if(!strcmp(cmdtext,"/mapsave",true,8))
{
	if(!cmd[10])return SendClientMessage(playerid,0xFF0000FF,"Use /mapsave [markertyp]");
	new Float:pos[3];
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	new File:iox = fopen("markers.txt",io_append);
	new fmstr[128];
	format(fmstr,sizeof fmstr,"SetPlayerMapIcon(playerid,iconid,%f,%f,%f,%d,0);\r\n",
	pos[0],pos[1],pos[2],strval(cmdtext[10]));
	fwrite(iox,fmstr);
	fclose(iox);	
	return 1;
}
Ahh, yes i have that.
I need to know how to load it, when it have been saved to a file.
Reply
#6

Dini/DUBD??
________
Box Vaporizer
Reply
#7

Yeees, dini/dudb. but how?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)