addobject not working.....
#1

Hi guyz...
/addobject command dont spawns an object but we get message,"You have spawned.."
Here is the script:
PHP код:
COMMAND:addobject(playeridparams[])
{
    new 
ObjectID;
    if(
PlayerInfo[playerid][pSpawned] == 1)
    {
    if(
PlayerInfo[playerid][pAdminlevel] > 0)
    {
    if(
sscanf(params"d"ObjectID))
    {
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /addobject (Object ID)");
    return 
1;
    }
    if(
ObjectID >= 20000)
    {
    
SendClientMessage(playeridCOLOR_ERROR"Invalid Object ID.");
    return 
1;
    }
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    
PlayerObjectCount[playerid]++;
    
PlayerObject[playerid][PlayerObjectCount[playerid]] = CreateDynamicObject(ObjectID660.50.00.096.0);
    new 
string[128];
    
format(stringsizeof string"You Have Spawned Object ID %d. Editing ID %d."ObjectIDPlayerObjectCount[playerid]);
    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
    }
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command While You're Dead.");
    }
    return 
1;

Reply
#2

I made a small change to your script to make it compatible with mine, this portion of the code works for me.

pawn Код:
CMD:addobject(playerid, params[])
{
    new ObjectID;
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerAdmin(playerid))
        {

            if(sscanf(params, "d", ObjectID))
            {
                SendClientMessage(playerid, -1, "USAGE: /addobject (Object ID)");
                return 1;
            }
            if(ObjectID >= 20000)
            {
                SendClientMessage(playerid, -1, "Invalid Object ID.");
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            CreateDynamicObject(ObjectID, x + 6, y + 6, z + 0.5, 0.0, 0.0, 96.0);
            new string[128];
            format(string, sizeof(string), "Object ID %d created at X:%.2f, Y:%.2f, Z:%.2f", ObjectID, x, y, z);
            SendClientMessage(playerid, -1, string);
        }
        else return SendClientMessage(playerid,-1,"ERROR");
    }
    else return SendClientMessage(playerid,-1,"You Cannot Use This Command While You're Dead.");
    return 1;
}
Reply
#3

Lynn he want it to remove too... ( i think, because he use and this code: PlayerObject[playerid][PlayerObjectCount[playerid]])

This code it means in the future MAYBE want to remove it or edit this
Reply
#4

Quote:
Originally Posted by kyriakos587
Посмотреть сообщение
Lynn he want it to remove too... ( i think, because he use and this code: PlayerObject[playerid][PlayerObjectCount[playerid]])

This code it means in the future MAYBE want to remove it or edit this
He asked to get the code working, so I did.
If he wants anything else done that's on him.
That was not part of his request.
Reply
#5

Yea LYN Btw +Rep for you both... and i have" COMMAND: "..and i have to edit and remove too as i have the script to remove and edit.
Reply
#6

Anyone there?
Reply
#7

Can someone help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)