[HELP] Pickup's don't work corectly
#1

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;
}
Reply
#2

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! 
Reply
#3

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...
Reply
#4

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

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
Reply
#6

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
Reply
#7

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.
Reply
#8

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
Reply
#9

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

Код:
{
    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#)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)