CMD not working
#1

So I made an /addcrane and /destroycrane for my server, here are the CMDs
pawn Код:
new CraneObject;

CMD:addcrane(playerid, params[])
{
    new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
    GetPlayerPos(playerid, X, Y, Z);
    CraneObject = CreateDynamicObject(1378, X, Y, Z, 0.0, 0.0, 0.0);

    return 1;
}

CMD:destroycrane(playerid, params[])
{
    DestroyDynamicObject(CraneObject);
    return 1;
}
But for some reason when I do /addcrane nothing happens, the object is not created.. Help anyone.
Reply
#2

pawn Код:
CraneObject = CreateDynamicObject(1378, X, Y, Z, 0.0, 0.0, 0.0);
to

pawn Код:
CraneObject = CreateDynamicObject(modelid, X, Y, Z, 0.00, 0.00, 0.00, 0, 0, -1, 300.0);
Try it.
Reply
#3

So I remove my modelid or add it where it says "modelid"? Anyways, I put my modelid where it said "modelid", Im compiling script, getting ready to test it
Reply
#4

I forgot to change that for you. "modelid" is supposed to be "1378".
Reply
#5

Still not working
Reply
#6

I was able to spawn a crane successfully using this:

pawn Код:
#include <a_samp>
#include <zcmd>
#include <streamer>

new CraneObject;

CMD:addcrane(playerid, params[])
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    CraneObject = CreateDynamicObject(1378, X, Y, Z, 0.00, 0.00, 0.00, 0, 0, -1, 300.0);
   
    SendClientMessage(playerid, -1, "Spawned crane object!");
    return 1;
}

CMD:destroycrane(playerid, params[])
{
    DestroyDynamicObject(CraneObject);
    return 1;
}
Not sure why it won't work for you. Make sure you move in order to see the object.
Reply
#7

Alright, just got it I think, when I put the Thing u sent me that worked in a Gamemode script that had no streamer functions and tried to start it, streamer told me this warning
Код:
[16:28:14] *** Streamer Plugin: Warning: Include file version (0x26105) does not match plugin version (0x27002) (script might need to be recompiled with the latest include file)
Reply
#8

Download this and replace all your existing files with the ones you just downloaded, then re-compile and it will work.
Reply
#9

kk ty, got one question whilst i compile, when u addcrane do u get stuck in it or on top?
Reply
#10

It spawns and is stuck in the floor (atleast when I tested it), you can fix it easily though by adding a higher value to the "Z" coordinate (i.e. "x, y, z + 20").

Just experiment with it and you'll figure it out.

You can also implement this function so you can move the object after it's spawned.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)