i've made a script, no error but doesn't work
#1

I've made a script, no error but script doesn't work..
PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define culoare 0xFFFFFFAA
new objectmodel[500];
forward WriteLog(string[]);
new 
Object;
COMMAND:createobject(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
Model;
        if(
sscanf(params,"i"Model)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/CreateObject [ObjectID]");
        new 
Float:X;
        new 
Float:Y;
        new 
Float:Z;
        
GetPlayerPos(playeridXYZ);
        
Object CreateObject(ModelXYZ000100.0);
        
EditObject(playerid,Object);
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}* {FF0000}ERROR: {FF0000}Only RCON can use this command !");
    }
    return 
1;
}
COMMAND:editobject(playeridparams[])
{
    new 
oid;
    if (!
sscanf(params"i",oid ))
    {
        
EditObject(playeridoid);
        return 
1;
    }else{
SendClientMessage(playerid,culoare,"USE : /editobject [objectid]");SendClientMessage(playerid,culoare,"INFO :Type /objects for a list of created objects"); return 1;}
    
}
COMMAND:gotoobject(playeridparams[])
{
    new 
oid;
    if (!
sscanf(params"i",oid ))
    {
        new 
Float:xoFloat:yoFloat:zo;
        
GetObjectPos(oidxoyozo);
        
SetPlayerPos(playerid,xo+1,yo+1,zo+1);
        return 
1;
    }else{
SendClientMessage(playerid,culoare,"Use :/gotoobject[objectid]"); return 1;}
}
COMMAND:ohelp(playerid,params[])
{
    
SendClientMessage(playerid,culoare,"/addobject || /editobject ||/gotoobject || /objects || /savemap");
    
SendClientMessage(playerid,culoare,"/oprew");
    return 
1;
}
COMMAND:savemap(playeridparams[])
{
    for(new 
0<=500i++)
    {
        new 
stringg[128];
        new 
Float:RotX,Float:RotY,Float:RotZ;
        
GetObjectRot(iRotXRotYRotZ);
        new 
Float:xoFloat:yoFloat:zo;
        
GetObjectPos(ixoyozo);
        if(
xo!=&& yo!=&& zo!=0)
        {
            
format(stringgsizeof(stringg), "CreateObject(%d,%f,%f,%f,%f,%f,%f);",objectmodel[i],xo,yo,zo,RotX,RotY,RotZ,90);
            
WriteLog(stringg);
        }
        
    }
    new 
stringg[128];
    
format(stringgsizeof(stringg), "________________//\\_______________");
    
WriteLog(stringg);
    
SendClientMessage(playerid,culoare,"All Objects have been saved to mapa.txt");
    return 
1;
}
COMMAND:objects(playeridparams[])
{
    
SendClientMessage(playerid,culoare,"___________L I S T______________");
    for(new 
1<=500i++)
    {
        new 
stringg[128];
        new 
Float:RotX,Float:RotY,Float:RotZ;
        
GetObjectRot(iRotXRotYRotZ);
        new 
Float:xoFloat:yoFloat:zo;
        
GetObjectPos(ixoyozo);
        if(
xo!=&& yo!=&& zo!=0)
        {
            
format(stringgsizeof(stringg), "ID:%dCreateObject(%d,%f,%f,%f,%f,%f,%f);",i,objectmodel[i],xo,yo,zo,RotX,RotY,RotZ);
            
SendClientMessage(playerid,culoare,stringg);
        }
    }
    
SendClientMessage(playerid,culoare,"________________________________");
    return 
1;
}
public 
WriteLog(string[])
{
    new 
entry[192];
    
format(entrysizeof(entry), "%s\n",string);
    new 
File:hFile;
    
hFile fopen("mapa.txt"io_append);
    
fwrite(hFileentry);
    
fclose(hFile);
    return 
1;
}
public 
OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
{
    new 
Float:oldXFloat:oldYFloat:oldZ,
    
Float:oldRotXFloat:oldRotYFloat:oldRotZ;
    
GetObjectPos(ObjectoldXoldYoldZ);
    
GetObjectRot(ObjectoldRotXoldRotYoldRotZ);
    if(!
playerobject)
    {
        if(!
IsValidObject(Object)) return;
        
MoveObject(ObjectfXfYfZ10.0fRotXfRotYfRotZ);
    }

And i've made another one but it works and it's without save, edit object How do i add to it but it must work

here's working script:

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
new Object;
CMD:createobject(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        new 
Model;
        if(
sscanf(params,"i"Model)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/CreateObject [ObjectID]");
        new 
Float:X;
        new 
Float:Y;
        new 
Float:Z;
        
GetPlayerPos(playeridXYZ);
        
Object CreateObject(ModelXYZ000100.0);
        
EditObject(playerid,Object);
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}* {FF0000}ERROR: {FF0000}Only RCON can use this command !");
    }
    return 
1;
}
public 
OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
{
    new 
Float:oldXFloat:oldYFloat:oldZ,
    
Float:oldRotXFloat:oldRotYFloat:oldRotZ;
    
GetObjectPos(ObjectoldXoldYoldZ);
    
GetObjectRot(ObjectoldRotXoldRotYoldRotZ);
    if(!
playerobject)
    {
        if(!
IsValidObject(Object)) return;
        
MoveObject(ObjectfXfYfZ10.0fRotXfRotYfRotZ);
    }

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)