public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/saveX", true) == 0)
{
new Float:Pos[3], str[64], n[24], str2[30];
GetPlayerName(playerid, n, sizeof n);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(!fexist("File.txt")) { dini_Create("File.txt"); }
format(str2, sizeof str2, "%sX", n);
format(str, sizeof str, "%f", Pos[0]);
dini_Set("File.txt", str2, str);
format(str2, sizeof str2, "%sY", n);
format(str, sizeof str, "%f", Pos[1]);
dini_Set("File.txt", str2, str);
format(str2, sizeof str2, "%sZ", n);
format(str, sizeof str, "%f", Pos[2]);
dini_Set("File.txt", str2, str);
return 1;
}
if(strcmp(cmdtext, "/goX", true) == 0)
{
new str[64], n[24], str2[24], Float:Pos[3];
GetPlayerName(playerid, n, sizeof n);
format(str2, sizeof str2, "%sX", n);
if(!dini_Isset(str2))
return SendClientMessage(playerid, 0xFF0000FF, "No positions saved.");
Pos[0] = dini_Get("File.txt", str2, str);
format(str2, sizeof str2, "%sY", n);
Pos[1] = dini_Get("File.txt", str2);
format(str2, sizeof str2, "%sZ", n);
Pos[2] = dini_Get("File.txt", str2);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, 0xFFFF00FF, "Teleported to saved positions.");
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/goX", true) == 0)
{
new Float:Pos[3];
Pos[0] = dini_Float("Accounts/File1.txt", "Coordinate");
Pos[1] = dini_Float("Accounts/File2.txt", "Coordinate");
Pos[2] = dini_Float("Accounts/File3.txt", "Coordinate");
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, 0xFFFF00FF, "Teleported to saved positions.");
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/goX", true) == 0)
{
SetPlayerPos(playerid, dini_Float("Accounts/File1.txt", "Coordinate"), dini_Float("Accounts/File2.txt", "Coordinate"), dini_Float("Accounts/File3.txt", "Coordinate"));
SendClientMessage(playerid, 0xFFFF00FF, "Teleported to saved positions.");
return 1;
}
return 0;
}
public OnGameModeInit()
{
if(!fexist("Accounts/File1.txt")) { dini_Create("Accounts/File1.txt"); }
if(!fexist("Accounts/File2.txt")) { dini_Create("Accounts/File2.txt"); }
if(!fexist("Accounts/File3.txt")) { dini_Create("Accounts/File3.txt"); }
return 1;
}
How can it make a file4 without me having to add file4 in the .pwn?
|
Like have you seen those scripts where the person types something like: /createhouse and it creates a new file in scriptfiles and saves the coords of the house and then loads the coords and creates a pickup... How do they make it so that it keeps making houses without overwriting another file?
|