else, if blabalbla problems
#1

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;
}
Reply
#2

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

Thanks a lot man, rep+
Reply
#4

Fixed...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)