SA-MP Forums Archive
Please close this thread problem done. - 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: Please close this thread problem done. (/showthread.php?tid=84688)



Please close this thread problem done. - saiberfun - 02.07.2009

pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new str[256];
format(str,256,"You found %d Bombs",AccountInfo[playerid][unlock]);
if(pickupid == p1)
{
if(AccountInfo[playerid][up1] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][unlock] ++;
AccountInfo[playerid][up1] = 1;
}
else
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}}
when i pickup the pickup it says "You found 0Bombs" eventho AccountInfo[playerid][unlock] already equals 1
so it should be 1Bombs and it shouldnt be You found blah...
because AccountInfo[playerid][up1] equals 1...
could u tell me whats the problem?


Re: Problem with Playerpickupickup and if - woot - 02.07.2009

Put your SendClientMessage after AccountInfo[playerid][unlock] ++;


Re: Problem with Playerpickupickup and if - saiberfun - 02.07.2009

didnt really help still the same shit happens


Re: Problem with Playerpickupickup and if - refshal - 02.07.2009

pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new str[256];
format(str,256,"You found %d Bombs",AccountInfo[playerid][unlock]);
if(pickupid == p1)
{
if(AccountInfo[playerid][up1] == 0)
{
AccountInfo[playerid][unlock] ++;
AccountInfo[playerid][up1] = 1;
SendClientMessage(playerid,LIGHTGREEN,str);
}
else
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
}



Re: Problem with Playerpickupickup and if - saiberfun - 02.07.2009

still the same problems
imma send the whole OnPlayerPickupPickup maybe u see an error then..
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new str[256];
format(str,256,"You found %d Bombs",AccountInfo[playerid][unlock]);
if(pickupid == 1)
{
SetPlayerHealth(playerid,100);
}
if(pickupid == 2)
{
SetPlayerArmour(playerid,50);
}
if(pickupid == 3)
{
SetPlayerArmour(playerid,50);
}
if(pickupid == 4)
{
SetPlayerHealth(playerid,100);
}
if(pickupid == 5)
{
SetPlayerHealth(playerid,100);
}
if(pickupid == p1)
{
if(AccountInfo[playerid][up1] == 0)
{
AccountInfo[playerid][unlock] ++;
AccountInfo[playerid][up1] = 1;
SendClientMessage(playerid,LIGHTGREEN,str);
}
else
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p2)
{
if(AccountInfo[playerid][up2] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up2] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up2] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p3)
{
if(AccountInfo[playerid][up3] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up3] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up3] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p4)
{
if(AccountInfo[playerid][up4] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up4] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up4] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p5)
{
if(AccountInfo[playerid][up5] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up5] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up5] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p6)
{
if(AccountInfo[playerid][up6] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up6] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up6] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p7)
{
if(AccountInfo[playerid][up7] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up7] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up7] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p8)
{
if(AccountInfo[playerid][up8] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up8] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up8] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
if(pickupid == p9)
{
if(AccountInfo[playerid][up9] == 0)
{
SendClientMessage(playerid,LIGHTGREEN,str);
AccountInfo[playerid][up9] = 1;
AccountInfo[playerid][unlock] ++;
}
else
if(AccountInfo[playerid][up9] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
}
return 1;
}



Re: Problem with Playerpickupickup and if - saiberfun - 02.07.2009

tried to change the way now
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new str[256];
format(str,256,"You found %d Bombs",AccountInfo[playerid][unlock]);
if(pickupid == p1)
{
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
else
if(AccountInfo[playerid][up1] == 0)
{
AccountInfo[playerid][unlock] ++;
AccountInfo[playerid][up1] = 1;
SendClientMessage(playerid,LIGHTGREEN,str);
}
}
}
but still it does go around the
pawn Code:
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
Please Help


Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - Ignas1337 - 02.07.2009

why do you format a message and then change a var and only then send a message? format AFTER variable changes and send message then.


Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - refshal - 02.07.2009

pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new str[256];
format(str,256,"You found %d Bombs",AccountInfo[playerid][unlock]);
if(pickupid == p1)
{
if(AccountInfo[playerid][up1] == 1)
{
SendClientMessage(playerid,ADMIN_RED,"You already picked up this pickup.");
}
else
if(AccountInfo[playerid][up1] == 0)
{
AccountInfo[playerid][unlock] ++;
AccountInfo[playerid][up1] = 1;
SendClientMessage(playerid,LIGHTGREEN,str);
return 1;
}
Try that one.


Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - Nero_3D - 02.07.2009

@Coop, I recommend you to read this post again

Quote:
Originally Posted by Izanagi
why do you format a message and then change a var and only then send a message? format AFTER variable changes and send message then.



Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - saiberfun - 02.07.2009

Quote:
Originally Posted by Izanagi
why do you format a message and then change a var and only then send a message? format AFTER variable changes and send message then.
well i fixed that already only thing annoying me atm is that it does go around the if(AccountInfo[playerid][up1] == 1)
like ti doesnt show

and @coop: sry didnt put the return in the pawn code here but in the fs it is


Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - refshal - 02.07.2009

Quote:
Originally Posted by ♣ ⓐⓢⓢ
@Coop, I recommend you to read this post again
It was just a suggestion...


Re: Problem with Playerpickupickup and if[please help long time nobody tried now...] - saiberfun - 02.07.2009

Quote:
Originally Posted by cοοp
Quote:
Originally Posted by ♣ ⓐⓢⓢ
@Coop, I recommend you to read this post again
It was just a suggestion...
ye ty for that man^-^

and erm..
dunno how but i fixed the prob on my own.
weird...


Re: Please close this thread problem done. - Ignas1337 - 02.07.2009

well grats in doing so I go watch a movie now so I will be out of reach. Good luck whith whatever yo're scripting