Pickup problem - 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)
+--- Thread: Pickup problem (
/showthread.php?tid=510821)
Pickup problem -
Djumza - 02.05.2014
Hello guys..
Today i made pickup inside gym , the plan was to make dialog so players can choose their fight style.
But i got a little problem, dialog is opening again and again when player go inside of pickup.Player cant select fight style from the list because list item 1 is always selected,even if u try to select other item,its still going back to first item (i guess because server opened again dialog).
Sorry for my bad english, if you need any part of the script just say..
Re: Pickup problem -
[WSF]ThA_Devil - 02.05.2014
https://sampwiki.blast.hk/wiki/PickupTypes
TYPE 1 does call the callback all the time, either, use bool to check if player has picked up it lately and setting timer, or selecting other type.
Re: Pickup problem -
Djumza - 02.05.2014
Thanks, would i be rude if i please you to show me example how to check it/script it ?
Re: Pickup problem -
[WSF]ThA_Devil - 02.05.2014
on top of script:
Код:
new bool:pPickedUp[MAX_PLAYERS];
OnPlayerConnect:
pPickedUp[playerid] = false;
OnPlayerPickupPickup:
if(pickupid == ???) {
if(pPickedUp[playerid] == false){
pPickedUp[playerid] = true;
SetTimerEx("ResetPickedUp",10000,false,"i",playerid);
}
}
forward ResetPickedUp(playerid);
public ResetPickedUp(playerid) {
pPickedUp[playerid] = false;
}
I did not test the code, and it is not suppoused to work.
Re: Pickup problem -
Djumza - 02.05.2014
Thanks a lot, im getting this error, error 032: array index out of bounds (variable "pPickedUp") (pPickedUp[MAX_PLAYERS] = false
Re: Pickup problem -
[WSF]ThA_Devil - 02.05.2014
Quote:
Originally Posted by Djumza
Thanks a lot, im getting this error, error 032: array index out of bounds (variable "pPickedUp") (pPickedUp[MAX_PLAYERS] = false 
|
MAX_PLAYERS must be there when you define new varriable, otherwise it must be playerid
my mistake, on OnPlayerConnect
Re: Pickup problem -
Djumza - 02.05.2014
Sorry but i dont get it.. I done everything like you said in your 2nd post, and i got this error : error 032: array index out of bounds (variable "pPickedUp")
Line :
public OnPlayerConnect(playerid)
{
===Error line===> pPickedUp[MAX_PLAYERS] = false;
.....
Re: Pickup problem -
[WSF]ThA_Devil - 02.05.2014
I said, I made a problem there...
change it to
pPickedUp[playerid] = false;
Re: Pickup problem -
Djumza - 02.05.2014
Thank you a lot man..

Sorry im so tired my brain just didnt read "otherwise" ..