SA-MP Forums Archive
else, if blabalbla problems - 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: else, if blabalbla problems (/showthread.php?tid=288442)



else, if blabalbla problems - System64 - 07.10.2011

So, I started my new FS, UAV Drone!

It create UAV and than you can control it, I made that you can create one UAV, but when I remove UAV (/uavstop)
I can't create UAV again :S
Here is the whole script:
pawn Код:
#include <a_samp>
#include <YSI\y_commands>

new Float: Pos[4], uavobj, UAVObject = 0, bool: UAVStarted;
public OnFilterScriptInit()
{
    print("\n");
    print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
    print("  \4 S32Predator Drone \4");
    print("  \4 by                \4");
    print("  \4 System32          \4");
    print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

YCMD:uavstart(playerid, params[], help)
{
    #pragma unused help
    #pragma unused params
    UAVStarted = true;
    UAVObject = UAVObject + 1;
    if(UAVObject == 1)
    {
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        uavobj = CreatePlayerObject(playerid, 18846, Pos[0], Pos[1], Pos[2] + 10, 90.000000, 0.000000, 0.000000, 300);
        SendClientMessage(playerid, 0x10F441AA, "UAV has came, type /uavcontrol to start controlling UAV!");
    }
    else SendClientMessage(playerid, 0xFF0000FF, "You can create just one UAV!");
    return 1;
}

YCMD:uavstop(playerid, params[], help)
{
    #pragma unused help
    #pragma unused params
    UAVStarted = false;
    UAVObject = UAVObject = - 1;
    DestroyPlayerObject(playerid, uavobj);
    SendClientMessage(playerid, 0x10F441AA, "UAV has gone!");
    return 1;
}

YCMD:uavcontrol(playerid, params[], help)
{
    #pragma unused help
    #pragma unused params
    if(UAVStarted == false) return SendClientMessage(playerid, 0xFF0000FF, "You didn't started UAV!");
    return 1;
}



Re: else, if blabalbla problems - Vince - 07.10.2011

Because you set the UAVObject to -1 in your stop command. Set it to 0 and it should be fixed.


Re: else, if blabalbla problems - System64 - 07.10.2011

Thanks a lot man, rep+


Re: else, if blabalbla problems - Kush - 07.10.2011

Fixed...