SA-MP Forums Archive
[HELP] Pickup's don't work corectly - 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: [HELP] Pickup's don't work corectly (/showthread.php?tid=318931)



[HELP] Pickup's don't work corectly - Stefand - 17.02.2012

Hello,

I'm making an Cops Vs. Criminals DeathMatch,

But i want give cops some more ammo like my filterscript below,
But it doesn't work can someone look at it please?

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#if defined FILTERSCRIPT

new policegun1;
new policegun2;
new policegun3;
new policegun4;
new policegun5;

public OnFilterScriptInit()
{
    UsePlayerPedAnims();
    CreatePickup(1242, 3, 2507.8369, -1656.8049, 13.5938);
    CreatePickup(336, 3, 2510.3140, -1659.4635, 13.5938);
    CreatePickup(348, 3, 2512.6199, -1668.4495, 13.5628);
    CreatePickup(355, 3, 2511.4939, -1675.6918, 13.5451);
    CreatePickup(350, 3, 2501.7224, -1685.2773, 13.4716);
   
    //Politie
    policegun1 = CreatePickup(1242, 3, 1585.9580, -1691.9110, 6.2188);
    policegun2 = CreatePickup(356, 3, 1586.9224, -1679.2471, 5.8970);
    policegun3 = CreatePickup(353, 3, 1586.4342, -1683.5643, 6.2252);
    policegun4 = CreatePickup(346, 3, 1586.2582, -1687.6957, 6.2188);
    policegun5 = CreatePickup(359, 3, 1587.1272, -1675.2145, 5.8973);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == policegun1){
    SetPlayerArmour(playerid, 100);
    }
    if(pickupid == policegun2){
    SetPlayerAmmo(playerid, 5, 1000);
    }
    if(pickupid == policegun3){
    SetPlayerAmmo(playerid, 4, 1000);
    }
    if(pickupid == policegun4){
    SetPlayerAmmo(playerid, 2, 1000);
    }
    if(pickupid == policegun5){
    SetPlayerAmmo(playerid, 7, 25);
    }
    return 1;
}



Re: [HELP] Pickup's don't work corectly - Twisted_Insane - 17.02.2012

Hi!

Under "OnPlayerPickUpPickup", you have to use from the second pickup on the "else if" statment! Would look like this:

PHP код:
if(pickupid == policegun1) {
SetPlayerArmour(playerid100);
}
else if(
pickupid == policegun2) {
SetPlayerAmmo(playerid5500);
}
//just continue with the others also using the "else if"-statements! 



Re: [HELP] Pickup's don't work corectly - Stefand - 17.02.2012

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Hi!

Under "OnPlayerPickUpPickup", you have to use from the second pickup on the "else if" statment! Would look like this:

PHP код:
if(pickupid == policegun1) {
SetPlayerArmour(playerid100);
}
else if(
pickupid == policegun2) {
SetPlayerAmmo(playerid5500);
}
//just continue with the others also using the "else if"-statements! 
Still not working...


Re: [HELP] Pickup's don't work corectly - Twisted_Insane - 17.02.2012

What exactly is not working? Maybe you forgot to set their virtual world to -1?


Re: [HELP] Pickup's don't work corectly - commander_abhi - 17.02.2012

and 1st make sures about your teams
it would be better if you add

#include <a_samp>
#define COPS 1
#define CRIMINALS 2
#define FILTERSCRIPT

#if defined FILTERSCRIPT

//make sure there spawn and add a gmaemode name too your server it could be just confussing you coz of no teams and nothing first make sure that a basic beta GM is redy and then try to make and add pickups try it


Re: [HELP] Pickup's don't work corectly - Stefand - 17.02.2012

Quote:
Originally Posted by commander_abhi
Посмотреть сообщение
and 1st make sures about your teams
it would be better if you add

#include <a_samp>
#define COPS 1
#define CRIMINALS 2
#define FILTERSCRIPT

#if defined FILTERSCRIPT

//make sure there spawn and add a gmaemode name too your server it could be just confussing you coz of no teams and nothing first make sure that a basic beta GM is redy and then try to make and add pickups try it
This is the Pickup filterscript


Re: [HELP] Pickup's don't work corectly - Madd Kat - 17.02.2012

weird how you got your numbers try this

pawn Код:
SetPlayerAmmo(playerid, pickupid , 1000);

and about the if
it dont really matter either way,

only difference is the else if will stop checking once
condition is met,
using just if's means it will check every one everytime
which is not really needed here. but wont break the code.


Re: [HELP] Pickup's don't work corectly - Stefand - 17.02.2012

Quote:
Originally Posted by Madd Kat
Посмотреть сообщение
weird how you got your numbers try this

pawn Код:
SetPlayerAmmo(playerid, pickupid , 1000);

and about the if
it dont really matter either way,

only difference is the else if will stop checking once
condition is met,
using just if's means it will check every one everytime
which is not really needed here. but wont break the code.
Doesn't work


Re: [HELP] Pickup's don't work corectly - Twisted_Insane - 17.02.2012

Wtf doesn't work? Could you tell us what exactly doesn't work? Also, did you set the VirtualWorld for the pickups?


Re: [HELP] Pickup's don't work corectly - Zarky - 17.02.2012

Код:
{
    if(pickupid == policegun1)
    {
    SetPlayerArmour(playerid, 100);
}
if(pickupid == policegun2)
{
    SetPlayerAmmo(playerid, 5, 1000);
    }    
if(pickupid == policegun3)
{
    SetPlayerAmmo(playerid, 4, 1000);
    }
if(pickupid == policegun4)
{
    SetPlayerAmmo(playerid, 2, 1000);
    }
if(pickupid == policegun5)
{
    SetPlayerAmmo(playerid, 7, 25);
    } 
return 1;
}
You Kept All the { After the if(pickupid == policegun#)