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
#2

Do you get anything in Server_Logs.txt?
Reply
#3

Quote:
Originally Posted by coool
Посмотреть сообщение
Do you get anything in Server_Logs.txt?
He means , he need to add save, edit object options in that command.
Reply
#4

Quote:
Originally Posted by UFF
Посмотреть сообщение
He means , he need to add save, edit object options in that command.
Exactly! Nothing found in server log.
Reply
#5

Anyone please help. Iam giving reputation for help
Reply
#6

why you dont use map editor for creating a good map?
Reply
#7

Quote:
Originally Posted by Florin48
Посмотреть сообщение
why you dont use map editor for creating a good map?
That's the point. I don't want to use map editor. I just want my command to be able to edit created objects in game. I don't want to save those objects in server. I just want to create them for fun, for some events.
I've made a command to create object, yes it works but i want to also be able to edit it in game.
Reply
#8

u use mysql?

and do u want the object to save or no i didnt understand.

the edit object not working to?
Reply
#9

Quote:
Originally Posted by AdamCooper
Посмотреть сообщение
u use mysql?

and do u want the object to save or no i didnt understand.

the edit object not working to?
I don't want to save object, thats useless.
Yep, editing is not working :/
Reply
#10

Maybe you can create first object and then make a command for editing or use timer?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)