SA-MP Forums Archive
Failure of creating a UAV System - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Failure of creating a UAV System (/showthread.php?tid=205238)



Failure of creating a UAV System - jameskmonger - 31.12.2010

I have tried to create a UAV System (and I was infact hesitant to post my attempts here) but it doesn't work. I type /uav and get the message "Friendly UAV Online!" but neither the enemies nor the friends do not show up on my radar.

pawn Код:
if(strcmp(cmdtext, "/uav", true, 3) == 0)
    {
        if(playerInfo[playerid][UAV] == 1)
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Friendly UAV Online!");
            playerInfo[playerid][UAV] = 0;
            for(new i; i>MAX_PLAYERS; i++) {
                if(!hasDied[i]) {
                    if(gTeam[i] == gTeam[playerid]) {
                        SetPlayerMarkerForPlayer( playerid, i, GetColorForTeam(gTeam[playerid]) );
                        for(new j; j>MAX_PLAYERS; j++) {
                            if(!hasDied[i]) {
                                if(gTeam[j] == gTeam[i]) {
                                    SetPlayerMarkerForPlayer( i, j, GetColorForTeam(gTeam[j]) );
                                    SendClientMessage(i, 0xFFFFFFFF, "{00FF00}Friendly UAV Online!");
                                } else if(gTeam[j] != gTeam[i]) {
                                    SetPlayerMarkerForPlayer( i, j, GetColorForTeam(gTeam[j]) );
                                    SendClientMessage(j, 0xFFFFFFFF, "{FF0000}Enemy UAV Online!");
                                }
                            }
                        }
                    } else if(gTeam[i] != gTeam[playerid]) {
                        SetPlayerMarkerForPlayer( playerid, i, GetColorForTeam(gTeam[i]) );
                        SendClientMessage(i, 0xFFFFFFFF, "{FF0000}Enemy UAV Online!");
                    }
                }
            }
        }
        return 1;
    }



Re: Failure of creating a UAV System - Backwardsman97 - 31.12.2010

pawn Код:
if(!strcmp(cmdtext, "/uav", true))
{
    if(playerInfo[playerid][UAV] == 1)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Friendly UAV Online!");
        playerInfo[playerid][UAV] = 0;
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(!hasDied[i])
            {
                if(gTeam[i] == gTeam[playerid])
                {
                    if(i != playerid)
                    {
                        SendClientMessage(i, 0xFFFFFFFF, "{00FF00}Friendly UAV Online!");
                        SetPlayerMarkerForPlayer( playerid, i, GetColorForTeam(gTeam[playerid]) );
                        for(new j; j<MAX_PLAYERS; j++)
                        {
                            if(!hasDied[j])
                            {
                                if(gTeam[j] == gTeam[i])
                                    SetPlayerMarkerForPlayer( i, j, GetColorForTeam(gTeam[i]) );
                                else
                                    SetPlayerMarkerForPlayer( i, j, GetColorForTeam(gTeam[j]) );
                            }
                        }
                    }
                }
                else
                {
                    SetPlayerMarkerForPlayer( playerid, i, GetColorForTeam(gTeam[i]) );
                    SendClientMessage(i, 0xFFFFFFFF, "{FF0000}Enemy UAV Online!");
                }
            }
        }
    }
    return 1;
}
Been outta pawn for a few months but give it a whirl. Not efficient but should work.