Closest dynamic object
#1

Alright so the problem is quite simple, it wont detect when you are near some atm
PHP код:
format(string,sizeof(string),"You have withdrawn %i$ into your bank account. You have %i$ in your bank now",ammount,AccInfo[playerid][BankMoney]);
for(new 
0sizeof(Atm_Object); i++) {
        if(
IsValidDynamicObject(i)) {
            
GetDynamicObjectPos(Atm_Object[i],x,y,z);
            if(
IsPlayerInRangeOfPoint(playerid5.0x,y,z)) {
                
GivePlayerCash(playerid,ammount);
                
AccInfo[playerid][BankMoney] -= ammount;
            }
        }
    }
SendClientMessage(playerid,COLOR_GREEN,string); 
Object creation
PHP код:
new Atm_Object[8]; 
Then later on Ive created them under gamemode init (dynamicobjects)
Reply
#2

Dynamic objects are player object so you should probably use GetPlayerObjectPos. If that doesn't work you may also try Streamer_GetFloatData. Also there is Streamer_IsItemVisible and Streamer_GetDistanceToItem.
Reply
#3

I see that you're using GetObjectPos instead of GetDynamicObjectPos

pawn Код:
native GetDynamicObjectPos(STREAMER_TAG_OBJECT objectid, &Float:x, &Float:y, &Float:z);
Reply
#4

Quote:
Originally Posted by Patrick
Посмотреть сообщение
I see that you're using GetObjectPos instead of GetDynamicObjectPos

pawn Код:
native GetDynamicObjectPos(STREAMER_TAG_OBJECT objectid, &Float:x, &Float:y, &Float:z);
Yeah I forgot to edit the thread, Ive fixed that, but still the issue remains

Quote:
Originally Posted by Vince
Посмотреть сообщение
Dynamic objects are player object so you should probably use GetPlayerObjectPos. If that doesn't work you may also try Streamer_GetFloatData. Also there is Streamer_IsItemVisible and Streamer_GetDistanceToItem.
Ill try it out and post results if I fail or succeed
Reply
#5

pawn Код:
if(IsValidDynamicObject(Atm_Object[i]))
Reply
#6

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
if(IsValidDynamicObject(Atm_Object[i]))
Actually thats it, thanks rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)