Pickups 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: Pickups problem (
/showthread.php?tid=296542)
Pickups problem -
knackworst - 11.11.2011
Hello, I got a pickup problem that I haven't had before...
well the problem is that when I enter one pickup it does not do what I want it to do...
look:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[128];
if(pickupid == PackagePickup)
return PackageHuntFound(playerid);
if(pickupid == cannonpickup)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a car to use the cannon!");
GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!", 3000, 4);
SetTimerEx("cannongatesopen", 3000, false, "i", playerid); //3 seconds
TogglePlayerControllable(playerid,0);
}
return 1;
}
As you can see I made a little hidden package game, and also a cannon thing but when I pickup the cannonpickup I get the messages from the Hidden pacakge hunting... any help?
thanks inadvance
rep for helper
Re: Pickups problem -
=WoR=G4M3Ov3r - 11.11.2011
I didn't get what you mean, You don't get this ?
PHP код:
GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!", 3000, 4);
Re: Pickups problem -
knackworst - 11.11.2011
No, when I pickup the pickup I get everything that falls under the pickup from the package hunt
Re: Pickups problem -
=WoR=G4M3Ov3r - 12.11.2011
Its because you haven't return true under
PHP код:
if(pickupid == PackagePickup)
return PackageHuntFound(playerid);
I believe that's the reason why it keeps repeatin.
Re: Pickups problem -
knackworst - 12.11.2011
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[128];
if(pickupid == PackagePickup)
{
PackageHuntFound(playerid);
return 1;
}
if(pickupid == cannonpickup)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a car to use the cannon!");
GameTextForPlayer(playerid,"~r~G~g~e~y~t ~p~R~r~e~g~a~y~d~b~y!", 3000, 4);
SetTimerEx("cannongatesopen", 3000, false, "i", playerid); //3 seconds
TogglePlayerControllable(playerid,0);
}
return 1;
}
still the same problem...
more code:
pawn Код:
public PackageHuntFound(playerid)
{
new name[MAX_PLAYER_NAME], string[128], rand;
GetPlayerName(playerid, name, sizeof(name));
rand = random(sizeof(pHunt));
pIndex = rand;
KillTimer(PackageHuntRestartTimer);
DestroyPickup(PackagePickup);
format(string, sizeof(string), "Hidden Package: Player %s(%i) has found the current package and earned 50000$", name, playerid);
SendClientMessageToAll(COLOR_WHITE, string);
format(string, sizeof(string), "Hidden Package: A new package was placed, tip: %s (/packagehunt)" ,pHunt[pIndex][pTip]);
SendClientMessageToAll(COLOR_WHITE, string);
PackagePickup = CreatePickup(1276, 23, pHunt[pIndex][pX], pHunt[pIndex][pY], pHunt[pIndex][pZ], -1);
PackageHuntRestartTimer = SetTimer("PackageHuntRestart", PackageRestart, false); // look at the defines for the exact time...
GivePlayerMoney(playerid, 50000);
pData[playerid][pHiddenPackage]++;
return 1;
}