How to detect if a player has a custom object?
#1

Hello,

If you have created a custom.img and you want people to download it so that they can see new objects in your server,

is it possible then to detect if they have downloaded the custom.img?

so something like IsValidObjectForPlayer(playerid, objectid); ?
Reply
#2

Yes... that could be an option, I guess.
You need add a new object from your own, and then you can detect.
Just guessing, because it sounds possible.
Reply
#3

maybe I can create a custom object at onplayerconnect, and put the player On that object.
then check if their position has changed, if so, they are falling, which means they don't have the custom object

but that's not a real good way to check it haha
is there any other way?
Reply
#4

You can do something like this under OnPlayerConnet;

It may be work, never tried...
pawn Код:
if(!IsValidPlayerObject(playerid, objectid))
{
    SendClientMessage(...);
    Kick(playerid);
}
else DestroyPlayerObject(playerid, objectid);
Reply
#5

IsValidPlayerObject(playerid, objectid) doesn't exist,
it was just a suggestion to add this.
Reply
#6

It does; take...
https://sampwiki.blast.hk/wiki/IsValidPlayerObject

That makes your problem easier, I guess...
Because it seems like you didn't know this. I also didn't know, was looking for and booom.
There is a function such as this, good luck.
Reply
#7

oh!

so does it also return false for a player that Doesn't have your custom.img file?
and returns true for a usually invalid id, but that is now valid because you added it to the custom.img file?
Reply
#8

I think it is;
pawn Код:
Returns 1 if the object exists, 0 if not.
Well, you can try... and If you need help by checking if it works.
Like I'll connect to your server without your COSTUM.
If you need help, I am here.
Reply
#9

I don't really need help for checking, because I can just delete my own custom.img


I just tested it:
it always returns True
because when the object is invalid, a "question mark object" will be created, which is also a valid object.
Reply
#10

Quote:
Originally Posted by ғαιιοцт
Посмотреть сообщение
I don't really need help for checking, because I can just delete my own custom.img


I just tested it:
it always returns True
because when the object is invalid, a "question mark object" will be created, which is also a valid object.
And can't you use my little example? even if it shows "question mark object" (means invalid)... kick the player then.
Or whatever you wanted to.
Try that..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)