need urgent help [rep++ in return].
#1

Hello,

Well I have a property system but it's not the typical system seen in roleplay server this one is based on a gang can attack and dominate it, and fight for it. And if the cops (criminal justice) attack and dominate it, the owner will be no-one (it will be granted back to the city). I've created the pickups and an enumaretor with the info.. however when I go pick up the pickup nothing happens at all.

First, my enumaretor:
pawn Код:
#define MAX_PROPS 12

enum prinf
{
    PickupID,
    OwnerTeam,
    Name[64],
    Float:PropX,
    Float:PropY,
    Float:PropZ,
}

new PropInfo[MAX_PROPS][prinf];
And how I create the pickups:
pawn Код:
stock CreatePickupEx( model, type, Float:x, Float:y, Float:z, teamset )
{
    PropInfo[teamset][PickupID] = CreatePickup( model, type, x, y, z );
    PropInfo[teamset][PropX] = x;
    PropInfo[teamset][PropY] = x;
    PropInfo[teamset][PropZ] = x;

    return 1;
}
pawn Код:
if ( pickupid == PropInfo[PROP_BUNKER1][PickupID]
        || pickupid == PropInfo[PROP_BUNKER2][PickupID]
        || pickupid == PropInfo[PROP_BUNKER3][PickupID]
        || pickupid == PropInfo[PROP_IDLEWOOD_HIDEOUT][PickupID]
        || pickupid == PropInfo[PROP_IDLEWOOD_HOUSE][PickupID]
        || pickupid == PropInfo[PROP_JEFFERSON_HIDEOUT][PickupID]
        || pickupid == PropInfo[PROP_DRUGCARTEL][PickupID]
        || pickupid == PropInfo[PROP_DRUGFACTORY][PickupID]
        || pickupid == PropInfo[PROP_DRUGHOUSEGALORE][PickupID]
        || pickupid == PropInfo[PROP_THECARTER][PickupID]
        || pickupid == PropInfo[PROP_THECARTER_TWO][PickupID] )
    {
        for(new i = 0; i < MAX_PROPS /*12*/; i++)
        {
            if ( IsPlayerInRangeOfPoint( playerid, 2.0, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] ) )
            {
                if ( PropInfo[i][OwnerTeam] != TEAM_NONE ) // If a gang owns it
                {
                    format( szString, 128, "~p~property: ~w~%s~n~~p~owner:~w~ %s~n~~w~type /propcmds", PropInfo[i][Name], GetGangName(PropInfo[i][OwnerTeam]) );
                    GameTextForPlayer( playerid, szString, 5500, 3 );
                }
                else if ( PropInfo[i][OwnerTeam] == TEAM_NONE ) // If nobody owns it or been claimed by criminal justice.
                {
                    format( szString, 128, "~p~property: ~w~%s~n~~p~owner:~w~ no-one~n~~w~type /propcmds", PropInfo[i][Name] );
                    GameTextForPlayer( playerid, szString, 5500, 3 );
                }
            }
        }
I can't find a way arround, however I did some debugging and found out the script stops at this line:
pawn Код:
if ( IsPlayerInRangeOfPoint( playerid, 2.0, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] ) )
I hope you can help me.
Reply
#2

Quote:
Код:
if ( pickupid == PropInfo[PROP_BUNKER1][PickupID]
        || pickupid == PropInfo[PROP_BUNKER2][PickupID]
        || pickupid == PropInfo[PROP_BUNKER3][PickupID]
        || pickupid == PropInfo[PROP_IDLEWOOD_HIDEOUT][PickupID]
        || pickupid == PropInfo[PROP_IDLEWOOD_HOUSE][PickupID]
        || pickupid == PropInfo[PROP_JEFFERSON_HIDEOUT][PickupID]
        || pickupid == PropInfo[PROP_DRUGCARTEL][PickupID]
        || pickupid == PropInfo[PROP_DRUGFACTORY][PickupID]
        || pickupid == PropInfo[PROP_DRUGHOUSEGALORE][PickupID]
        || pickupid == PropInfo[PROP_THECARTER][PickupID]
        || pickupid == PropInfo[PROP_THECARTER_TWO][PickupID] )
This could be the cause of this problem. I really recommend you optimize this code by using a switch or any other more acceptable way to do a check like that.
Reply
#3

Quote:
Originally Posted by Schurman
Посмотреть сообщение
This could be the cause of this problem. I really recommend you optimize this code by using a switch or any other more acceptable way to do a check like that.
I doubt it since I have debugged and the script stops at..
pawn Код:
if ( IsPlayerInRangeOfPoint( playerid, 2.0, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ] ) )
Reply
#4

Show the declaration of the PropInfo array please.
Reply
#5

Quote:
Originally Posted by MP2
Посмотреть сообщение
Show the declaration of the PropInfo array please.
Uhm.
pawn Код:
#define MAX_PROPS (12)
enum prinf
{
    PickupID,
    OwnerTeam,
    Name[64],
    Float:PropX,
    Float:PropY,
    Float:PropZ,
}

new PropInfo[MAX_PROPS][prinf];
Reply
#6

Bump.
Reply
#7

Quote:
Originally Posted by admantis
Посмотреть сообщение
Bump.
Bump.
Reply
#8

Are you sure your array is filled correctly? (with data that is) debug it with print statements.
Reply
#9

pawn Код:
stock CreatePickupEx( model, type, Float:x, Float:y, Float:z, teamset )
{
    PropInfo[teamset][PickupID] = CreatePickup( model, type, x, y, z );
    PropInfo[teamset][PropX] = x;//<-
    PropInfo[teamset][PropY] = x;//<-
    PropInfo[teamset][PropZ] = x;//<-

    return 1;
}
this may be causing the problem.
Reply
#10

http://www.wiki.sa-mp.com/wiki/Debugging
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)