SA-MP Forums Archive
Help with Dynamic Teleport system, dialog bug. - 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: Help with Dynamic Teleport system, dialog bug. (/showthread.php?tid=424138)



File reading repeats. - lean1337 - 20.03.2013

Hi, Ive been working on a dynamic filterscript and when I do /createteleport id name , evrything saves to my teleport.ini but when I want to bring the dialog to teleport there later it's only a 0, nothing else.

EDIT: I managed to fix it, but it repeates in the dialog. also when I unload the evrything gets set back to default, but it stays the same in the teleport.ini


Create teleport CMD.
pawn Код:
CMD:createteleport(playerid, params[])
{
    new
         input[64],
         id,
         string[126],
         Float:X,
         Float:Y,
         Float:Z;

    if(sscanf(params,"is[32]",id,input)) return SendClientMessage(playerid,-1, "USAGE: /createteleport [TELEPORTNAME]");
    if(id < 0 || id > MAX_TELES) return SendClientMessage(playerid,-1, "There is too many teleports.");
    GetPlayerPos(playerid, X, Y, Z);
   // strmid(TeleInfo[TeleId][TeleName],input,0,strlen(input),255);
    format(string, sizeof(string), "SERVER: TeleportID: %i was created with the name %s",id, input);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    TeleInfo[id][TeleName] = input;
    TeleInfo[id][PosX] = X;
    TeleInfo[id][PosY] = Y;
    TeleInfo[id][PosZ] = Z;
    SaveTele();
    LoadTele();
    return 1;
}

Load and Save

pawn Код:
LoadTele()
{
    if(!fexist("/Teleport.ini")) return 1;
    new szFileInput[1024],File:fHandle = fopen("/Teleport.ini",io_read),index = 0;
    while(index < sizeof(TeleInfo) && fread(fHandle,szFileInput))
    {
        sscanf(szFileInput,"p<|>is[32]fff",
        TeleInfo[index][TeleId],
        TeleInfo[index][TeleName],
        TeleInfo[index][PosX],
        TeleInfo[index][PosY],
        TeleInfo[index][PosZ]

        );

        ++index;
    }
    return fclose(fHandle);
}

SaveTele()
{
    new szFileInput[1024],File:fHandle = fopen("/Teleport.ini",io_write);
    for(new d = 0; d < MAX_TELES; d++)
    {
    format(szFileInput,sizeof(szFileInput),"Teleport%i=%s  %f %f %f\r\n",d,TeleInfo[d][TeleName], TeleInfo[d][PosX], TeleInfo[d][PosY],TeleInfo[d][PosZ]);

    fwrite(fHandle,szFileInput);
    }
    return fclose(fHandle);
}
New SS added.

http://i.imgur.com/OJLdhvl.jpg


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 20.03.2013

I still need help with this. Anyone have a clue whats the issue?


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 21.03.2013

bump.


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 22.03.2013

bump


Re: Help with Dynamic Teleport system, dialog bug. - reckst4r - 22.03.2013

Could you give us the command to show the teleports list? There's no mistake in the code above


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 22.03.2013

pawn Код:
CMD:teleport3(playerid, params[])
{
    new string[600];
    new szFileInput[1024],File:fHandle = fopen("/Teleport.ini",io_read),index = 0;
    while(index < sizeof(TeleInfo) && fread(fHandle,szFileInput))
    for(new d = 0; d < MAX_TELES; d++)
    format(string, sizeof(string), "%s\nName: %s %d\n",string,TeleInfo[d][TeleName],d);
    ShowPlayerDialog(playerid,8055,DIALOG_STYLE_LIST,"Dynamic Port",string,"Teleport","Cancel");
    return 1;
}



Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 23.03.2013

bump


Re: Help with Dynamic Teleport system, dialog bug. - Denying - 23.03.2013

What's the problem? The order of the teleport IDs?


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 23.03.2013

Quote:
Originally Posted by Denying
Посмотреть сообщение
What's the problem? The order of the teleport IDs?
The order is fine but it dosent load any names or teleports, and it repeates in the dialog, after 29 it starts again.


Re: Help with Dynamic Teleport system, dialog bug. - lean1337 - 29.03.2013

BUMP.