Convert SA:MP to MTA
#8

Just add the RemoveBuildingForPlayer code in somefile.txt in your scriptfiles folder.

PHP код:

#include <a_samp>
#include <sscanf2>
main()
{
    
ConvertF("somefile.txt");
}
public 
OnGameModeInit()
{
    return 
1;
}
#define MAX_OBJECTS_TO_REMOVE   500
enum obInfo
{
        
Model,
        
Float:X,
        
Float:Y,
        
Float:Z,
        
Float:Radius,
}
new 
ObjectInfo[MAX_OBJECTS_TO_REMOVE][obInfo];
forward ConvertF(const file[]);
public 
ConvertF(const file[])
{
    new 
File:openfile fopen(file,io_read);
    if(!
openfile) return printf("File %s was not found. Please make sure you have placed it on your ScriptFiles folder."file);
    new 
File:newfile fopen("WorldObject.txt",io_write);
    new 
string[600], lodsobjectsobjectkk[50];
    while(
fread(openfilestring))
    {
        if(
object >= sizeof(ObjectInfo)) break;
        if(!
sscanf(string"P<(),>{s[2]}'playerid'dffff"ObjectInfo[object][Model],ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z], ObjectInfo[object][Radius]))
        {
            
format(string,sizeof(string),"\t<removeWorldObject id=\"removeWorldObject (sm_fir_copse1) (25)\" radius=\"%f\" interior=\"0\" model=\"%d\" lodModel=\"%d\" posX=\"%f\" posY=\"%f\" posZ=\"%f\" rotX=\"0\" rotY=\"0\" rotZ=\"0\"></removeWorldObject>\r\n",ObjectInfo[object][Radius], ObjectInfo[object][Model], ObjectInfo[object][Model], ObjectInfo[object][X],ObjectInfo[object][Y],ObjectInfo[object][Z]);
            
fwrite(newfile,string);
            
object++;
        }
    }
    
fwrite(newfile,"a");
    
fclose(openfile);
    
fclose(newfile);
    
printf("Code exported to WorldObject.txt. Objects converted: %d"object);
    return 
object;

Compile the above code and run it as a gamemode. The code wll be exported to WorldObject.txt
Reply


Messages In This Thread
Convert SA:MP to MTA - by Vlad_Dredd - 27.08.2014, 03:01
Re: Convert SA:MP to MTA - by Aerotactics - 27.08.2014, 03:06
Re: Convert SA:MP to MTA - by ThePhenix - 27.08.2014, 03:10
Re: Convert SA:MP to MTA - by Vlad_Dredd - 27.08.2014, 03:12
Re: Convert SA:MP to MTA - by Aerotactics - 27.08.2014, 03:13
Re: Convert SA:MP to MTA - by ThePhenix - 27.08.2014, 03:49
Re: Convert SA:MP to MTA - by Vlad_Dredd - 27.08.2014, 04:04
Re: Convert SA:MP to MTA - by ThePhenix - 27.08.2014, 04:16

Forum Jump:


Users browsing this thread: 3 Guest(s)