SA-MP Forums Archive
Opposite - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Opposite (/showthread.php?tid=584591)



Opposite - Fancy - 06.08.2015

When i use /balloon command so the balloon does not appear but when i try destroy balloon,it appears

Код:
CMD:balloon(playerid,params[])
{
	if(PlayerInfo[playerid][pAdmin] == 7)
	{
		if(PlayerInfo[playerid][pVip] == 0) return 0;

	    new Float:x,Float:y,Float:z;
	    GetPlayerPos(playerid, x, y, z);
	    SetPlayerPos(playerid, x, y, z+3.5);

	    new world = GetPlayerVirtualWorld(playerid);
		new	interior = GetPlayerInterior(playerid);

	    //CreateDynamicObject(modelid, x, y, z, rx, ry, rz, worldid, interiorid, playerid = -1, Float:streamdistance = STREAMER_OBJECT_SD, Float:drawdistance = STREAMER_OBJECT_DD);
	    Balloon[playerid] = CreateDynamicObject(19335, x, y, z, 0.0,0.0,0.0, world, interior);
	    Fire[playerid] = CreateDynamicObject(18692, x, y, z, 0.0, 0.0, 0.0, world, interior);
	    Fire1[playerid] = CreateDynamicObject(18692, x, y, z,0.0,0.0,0.0, world, interior);

	    //AttachDynamicObjectToObject(STREAMER_TAG_OBJECT objectid, attachtoid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz, syncrotation = 1);
	    AttachDynamicObjectToObject(Fire[playerid], Balloon[playerid], 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 1);
	    AttachDynamicObjectToObject(Fire1[playerid], Balloon[playerid], 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 1);

	    SendClientMessage(playerid,COLOR_GREENZ,"Use the following keys to control the controllable object");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_YES~ (Move Balloon Up)");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_NO~ (Move Balloon Down)");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_YES~ (Move Balloon Forward)");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_NO~ (Move Balloon Back)");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_NO~ (Move Balloon Left)");
	    SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_YES~ (Move Balloon Right)");
	    PlayerIn[playerid][BalloonPlayer] = 1;
    }
    return 1;
}

CMD:destroyballoon(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] == 7) {
	if(PlayerIn[playerid][BalloonPlayer] == 0) return GameTextForPlayer(playerid,"~g~you dident spawned any balloon",4500,3);
    DestroyObject(Balloon[playerid]);
    DestroyObject(Fire[playerid]);
    DestroyObject(Fire1[playerid]);
    PlayerIn[playerid][BalloonPlayer] = 0;
    }
    return 1;
}



Re: Opposite - Gammix - 06.08.2015

Make sure you have streamer in server.cfg (in plugins row).

Where as the destroying part is wrong cause you can't use dynamic object id for deleting through DestroyObject. Use DestroyDynamicObject there.


Re: Opposite - Fancy - 06.08.2015

Streamer is in my server.cfg folder


Re: Opposite - MarvinPWN - 06.08.2015

PHP код:
CMD:balloon(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] == 7)
    {
        if(
PlayerInfo[playerid][pVip] == 0)return 0;
        new 
Float:x,Float:y,Float:z,world,interior;
        
GetPlayerPos(playerid,x,y,z);
        
SetPlayerPos(playerid,x,y,z+3.5);
        
world GetPlayerVirtualWorld(playerid);
        
interior GetPlayerInterior(playerid);
        
Balloon[playerid] = CreateDynamicObject(19335,x,y,z,0.0,0.0,0.0,world,interior);
        
Fire[playerid] = CreateDynamicObject(18692,x,y,z,0.0,0.0,0.0,world,interior);
        
Fire1[playerid] = CreateDynamicObject(18692,x,y,z,0.0,0.0,0.0,world,interior);
        
AttachDynamicObjectToObject(Fire[playerid],Balloon[playerid],0.0,0.0,2.0,0.0,0.0,0.0,1);
        
AttachDynamicObjectToObject(Fire1[playerid],Balloon[playerid],0.0,0.0,4.0,0.0,0.0,0.0,1);
        
SendClientMessage(playerid,COLOR_GREENZ,"Use the following keys to control the controllable object");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_YES~ (Move Balloon Up)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_NO~ (Move Balloon Down)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_YES~ (Move Balloon Forward)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_NO~ (Move Balloon Back)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_NO~ (Move Balloon Left)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_YES~ (Move Balloon Right)");
        
PlayerIn[playerid][BalloonPlayer] = 1;
    }
    return 
1;
}
CMD:destroyballoon(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] == 7)
    {
        if(
PlayerIn[playerid][BalloonPlayer] == 0)return GameTextForPlayer(playerid,"~g~you dident spawned any balloon",4500,3);
        
DestroyDynamicObject(Balloon[playerid]);
        
DestroyDynamicObject(Fire[playerid]);
        
DestroyDynamicObject(Fire1[playerid]);
        
PlayerIn[playerid][BalloonPlayer] = 0;
    }
    return 
1;

Try this. If it doesn't work you should try this without the streamer.
This means:
CreateDynamicObject => CreateObject
AttachDynamicObjectToObject => AttachObjectToObject
DestroyDynamicObject => DestryObject


Re: Opposite - Fancy - 06.08.2015

Quote:
Originally Posted by MarvinPWN
Посмотреть сообщение
PHP код:
CMD:balloon(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] == 7)
    {
        if(
PlayerInfo[playerid][pVip] == 0)return 0;
        new 
Float:x,Float:y,Float:z,world,interior;
        
GetPlayerPos(playerid,x,y,z);
        
SetPlayerPos(playerid,x,y,z+3.5);
        
world GetPlayerVirtualWorld(playerid);
        
interior GetPlayerInterior(playerid);
        
Balloon[playerid] = CreateDynamicObject(19335,x,y,z,0.0,0.0,0.0,world,interior);
        
Fire[playerid] = CreateDynamicObject(18692,x,y,z,0.0,0.0,0.0,world,interior);
        
Fire1[playerid] = CreateDynamicObject(18692,x,y,z,0.0,0.0,0.0,world,interior);
        
AttachDynamicObjectToObject(Fire[playerid],Balloon[playerid],0.0,0.0,2.0,0.0,0.0,0.0,1);
        
AttachDynamicObjectToObject(Fire1[playerid],Balloon[playerid],0.0,0.0,4.0,0.0,0.0,0.0,1);
        
SendClientMessage(playerid,COLOR_GREENZ,"Use the following keys to control the controllable object");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_YES~ (Move Balloon Up)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~PED_SPRINT~+~k~~CONVERSATION_NO~ (Move Balloon Down)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_YES~ (Move Balloon Forward)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~VEHICLE_ENTER_EXIT~+~k~~CONVERSATION_NO~ (Move Balloon Back)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_NO~ (Move Balloon Left)");
        
SendClientMessage(playerid,COLOR_GREENZ,"~k~~SNEAK_ABOUT~+~k~~CONVERSATION_YES~ (Move Balloon Right)");
        
PlayerIn[playerid][BalloonPlayer] = 1;
    }
    return 
1;
}
CMD:destroyballoon(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] == 7)
    {
        if(
PlayerIn[playerid][BalloonPlayer] == 0)return GameTextForPlayer(playerid,"~g~you dident spawned any balloon",4500,3);
        
DestroyDynamicObject(Balloon[playerid]);
        
DestroyDynamicObject(Fire[playerid]);
        
DestroyDynamicObject(Fire1[playerid]);
        
PlayerIn[playerid][BalloonPlayer] = 0;
    }
    return 
1;

Try this. If it doesn't work you should try this without the streamer.
This means:
CreateDynamicObject => CreateObject
AttachDynamicObjectToObject => AttachObjectToObject
DestroyDynamicObject => DestryObject
Ok,now the balloon does not appear on deatroy command so it means destroy command is fixed but the balloon does not appear on the /balloon command


Re: Opposite - MarvinPWN - 06.08.2015

Quote:
Originally Posted by Fancy
Посмотреть сообщение
but the balloon does not appear on the /balloon command
Ok. Do you try this with CreateObject and AttachObjectToObject?


Re: Opposite - Fancy - 06.08.2015

Quote:
Originally Posted by MarvinPWN
Посмотреть сообщение
Ok. Do you try this with CreateObject and AttachObjectToObject?
Yes,already