1
mIRC/pawn Scripting / Re: Non-overwriting !saveloc for GUPS
« on: September 08, 2012, 11:06:23 pm »I know that, but that one is overwriting...Ow, what do I have to do then?I found this, but I only need the saveloc part, but when I try to compile it gives me errors...Code: [Select]#include <a_samp>
#include <core>
#include <float>
function8(arg0, arg1)
{
new File:var0 = 0, File:var1 = 0;
if(!fexist(arg0))
{
return 0;
}
var0 = fopen(arg0, 0);
var1 = fopen(arg1, 1);
new var2[75];
while(fread(var0, var2, 75))
{
function220(var2);
format(var2, 75, "%s\r\n", var2);
fwrite(var1, var2);
}
fclose(var0);
fclose(var1);
return 1;
}
function220(arg0)
{
new var0 = strlen(arg0);
if(!arg0)
{
return 0;
}
if(arg0[var0 - 1] == 10 || arg0[var0 - 1] == 13)
{
arg0[var0 - 1] = 0;
if(!arg0)
{
return 0;
}
if(arg0[var0 - 2] == 10 || arg0[var0 - 2] == 13)
{
arg0[var0 - 2] = 0;
}
}
return 0;
}
function448(arg0, arg1, arg2)
{
new var0[75];
new var1 = 0;
var0[0] = 0;
if(strlen(arg0) <= arg1)
{
return var0;
}
if(strlen(arg0) <= arg2 + arg1)
{
arg2 = strlen(arg0) - arg1;
}
if(0 >= arg2)
{
return var0;
}
for(var1 = arg1; arg2 + arg1 > var1; var1++)
{
var0[var1 - arg1] = arg0[var1];
if(!arg0[var1])
{
return var0;
}
}
var0[arg2] = 0;
return var0;
}
function70C(arg0, arg1)
{
new var0 = strlen(arg1);
new var1 = 0;
for(var1 = 0; var1 < var0; var1++)
{
arg0[var1] = arg1[var1];
}
arg0[var0] = 0;
return 0;
}
function800(arg0, arg1, arg2)
{
if(strlen(arg0) != strlen(arg1))
{
return 0;
}
if(!strcmp(arg0, arg1, arg2))
{
return 1;
}
return 0;
}
function8C4(arg0, &arg1, arg2)
{
new var0 = strlen(arg0);
new var1 = arg1;
new var2[75];
while(arg1 < var0 && arg0[arg1] != arg2 && arg1 - var1 < 74)
{
var2[arg1 - var1] = arg0[arg1];
arg1++;
}
var2[arg1 - var1] = 0;
if(arg1 < var0 && arg0[arg1] == arg2)
{
arg1++;
}
return var2;
}
functionB7C(arg0)
{
new var0[75];
var0[0] = 0;
if(!arg0)
{
return var0;
}
new var1 = 0;
for(var1 = 0; strlen(arg0) > var1; var1++)
{
var0[var1] = tolower(arg0[var1]);
}
var0[strlen(arg0)] = 0;
return var0;
}
functionD34(arg0)
{
new var0[75];
var0[0] = 0;
if(strfind(arg0, "=", true, 0) == -1)
{
return var0;
}
function70C(var0, functionB7C(function448(arg0, 0, strfind(arg0, "=", true, 0))));
return var0;
}
functionEC8(arg0)
{
new var0[75];
var0[0] = 0;
if(strfind(arg0, "=", true, 0) == -1)
{
return var0;
}
function70C(var0, function448(arg0, strfind(arg0, "=", true, 0) + 1, strlen(arg0)));
return var0;
}
function1054(arg0, arg1, arg2)
{
new File:var0 = 0, File:var1 = 0;
new var2 = 0;
new var3[75];
if(!arg1)
{
return 0;
}
format(var3, 75, "%s.part", arg0);
var0 = fopen(arg0, 0);
if(!var0)
{
return 0;
}
fremove(var3);
var1 = fopen(var3, 1);
while(fread(var0, var3, 75))
{
function220(var3);
if(!var2 && function800(functionD34(var3), arg1, true))
{
format(var3, 75, "%s=%s", arg1, arg2);
var2 = 1;
}
fwrite(var1, var3);
fwrite(var1, "\r\n");
}
if(!var2)
{
format(var3, 75, "%s=%s", arg1, arg2);
fwrite(var1, var3);
fwrite(var1, "\r\n");
}
fclose(var0);
fclose(var1);
format(var3, 75, "%s.part", arg0);
if(function8(var3, arg0))
{
return fremove(var3);
}
return 0;
}
function150C(arg0, arg1)
{
new File:var0 = 0;
new var1[75];
new var2[75];
var1[0] = 0;
var0 = fopen(arg0, 0);
if(!var0)
{
return var1;
}
while(fread(var0, var1, 75))
{
function220(var1);
if(function800(functionD34(var1), arg1, true))
{
var2[0] = 0;
strcat(var2, functionEC8(var1), 75);
fclose(var0);
return var2;
}
}
fclose(var0);
return var1;
}
public OnFilterScriptInir()
{
print("Sucessfully started!");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
main()
{
return 0;
}
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerText(playerid, text)
{
new var0[256];
new var1[128];
new var2 = 0;
var0 = function8C4(text, var2, 32);
if(!strcmp(var0, "!gotolocadmin", true))
{
var1 = function8C4(text, var2, 32);
if(!strlen(var1))
{
SendClientMessage(playerid, 0x33AA33AA, "USAGE: !gotoloc [Name]");
}
if(!IsLocationExist(var1))
{
SendClientMessage(playerid, 0x33AA33AA, "InValid Loc");
}
else
{
GotoLoc(playerid, var1);
}
return 1;
}
if(!strcmp(var0, "!saveloc", true))
{
var1 = function8C4(text, var2, 32);
if(!strlen(var1))
{
SendClientMessage(playerid, 0x04A36BF, "** pm >> USAGE: !saveloc <location>");
}
if(GetLocExists(var1))
{
SendClientMessage(playerid, 0x04A36BF, "** pm >> This location already exists.");
}
else
{
SaveLoc(playerid, var1);
}
return 1;
}
return 0;
}
public GotoLoc(playerid, arg1)
{
new var0[4][128];
new var1[128];
function2354(function150C("/SavedLocations/Locations.ini", arg1), var0, 32);
SetPlayerPos(playerid, floatstr(var0[0]), floatstr(var0[1]), floatstr(var0[2]), 0, 0);
format(var1, 128, "location: %s : (%.4f %.4f %.4f)", arg1);
SendClientMessage(playerid, 0x33AA33AA, var1);
return 1;
}
public SaveLoc(playerid, arg1)
{
new Float:var0 = 0.0, Float:var1 = 0.0, Float:var2 = 0.0, var3[254], var4[256];
new var5[128];
GetPlayerPos(playerid, var0, var1, var2);
GetPlayerName(playerid, var3, 254);
format(var4, 256, "%.4f %.4f %.4f", var0, var1, var2, var3);
function1054("/SavedLocations/Locations.ini", arg1, var4);
format(var5, 128, "Saved As %s Coords = (%.4f %.4f %.4f.)", arg1, var0, var1, var2);
SendClientMessage(playerid, 0x33AA33AA, var5);
return 1;
}
public IsLocationExist(arg0)
{
new var0[128];
var0 = function150C("/SavedLocations/Locations.ini", arg0);
return 1;
}
public GetLocExists(arg0)
{
if(strcmp(var0, "0", true))
{
}
new var0[128];
var0 = function150C("/SavedLocations/Locations.ini", arg0);
return 1;
}
function2354(arg0, arg1, arg2)
{
if(strcmp(var0, "0", true))
{
}
new var0 = 0, var1 = 0;
new var2 = 0;
new var3 = 0;
while(strlen(arg0) >= var0)
{
if(arg0[var0] == arg2 || var0 == strlen(arg0))
{
var3 = strmid(arg1[var2], arg0, var1, var0, 128);
arg1[var2][var3] = 0;
var1 = var0 + 1;
var2++;
}
var0++;
}
return 1;
}
Oh, really, you found that ?
That is a code from a .pwn file decompiled with DeAMX.
I really need the saveloc part :/
An decompiled version of a .pwn file will never show you the script with all names of variables or arguments added by you.
And from what I see this is a script from samp.
<code>#include <a_samp></code>
Try to compile the saveloc from GUPS to your server.
i need a non-overwriting one :/
like this, but I can't filter it out.