Help With Pickups
#1

PHP код:
public OnPlayerPickUpPickup(playeridpickupid)
{
    new 
string[1280],Float:XFloat:YFloat:Z;
    new 
Houseid PlayerInfo[playerid][pLastOutSideID];
    
GetPlayerPos(playeridXYZ);
    if(
PlayerInfo[playerid][pPickup][pickupid] == 0)
    {
        if (
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)ApplyAnimation(playerid"CARRY""liftup"3.0000001);
        if (
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)PlayerPlaySound(playerid1150XYZ);
        switch (
PickupInfo[pickupid][PkModel])
        {
            case 
1212:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found $10000.");
            
GameTextForPlayer(playerid,"~w~Found $10000"50003);
            
GivePlayerMoney(playerid,10000);
            }
            case 
1575:
            {
            if (
PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pVigilante] == 0)
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found 25 Grams Of Drugs.");
            
GameTextForPlayer(playerid,"~w~Found Drugs 25/grams"50003);
            
PlayerInfo[playerid][pDrugs] += 25;
            if (
PlayerInfo[playerid][pDrugs] > MAX_DRUGS)PlayerInfo[playerid][pDrugs] = MAX_DRUGS;
            }
            }
            case 
321:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Dildo.");
            
GameTextForPlayer(playerid,"~w~Found A Dildo"50003);
            
GivePlayerWeapon(playerid101);
            }
            case 
325:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found Some Flowers.");
            
GameTextForPlayer(playerid,"~w~Found Flowers"50003);
            
GivePlayerWeapon(playerid141);
            }
            case 
333:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Golf Club.");
            
GameTextForPlayer(playerid,"~w~Found A Golf Club"50003);
            
GivePlayerWeapon(playerid21);
            }
            case 
336:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Baseball Bat.");
            
GameTextForPlayer(playerid,"~w~Found A Baseball Bat"50003);
            
GivePlayerWeapon(playerid51);
            }
            case 
337:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Shovel.");
            
GameTextForPlayer(playerid,"~w~Found A Shovel"50003);
            
GivePlayerWeapon(playerid61);
            }
            case 
1609:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Turtle.");
            
GameTextForPlayer(playerid,"~w~Found A Turtle"50003);
            }
            case 
341:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Chainsaw.");
            
GameTextForPlayer(playerid,"~w~Found A Chainsaw"50003);
            
GivePlayerWeapon(playerid91);
            }
            case 
346:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Pistol And 50 Ammo.");
            
GameTextForPlayer(playerid,"~w~Found A Pistol"50003);
            
GivePlayerWeapon(playerid2250);
            }
            case 
349:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Shotgun And 20 Ammo.");
            
GameTextForPlayer(playerid,"~w~Found A Shotgun"50003);
            
GivePlayerWeapon(playerid2520);
            }
            case 
358:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Sniper And 10 Ammo.");
            
GameTextForPlayer(playerid,"~w~Found A Sniper"50003);
            
GivePlayerWeapon(playerid3410);
            }
            case 
371:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Parachute.");
            
GameTextForPlayer(playerid,"~w~Found A Parachute"50003);
            
GivePlayerWeapon(playerid461);
            }
            case 
1241:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found A Adrenaline Pill.");
            
GameTextForPlayer(playerid,"~w~Found Adrenaline Pill"50003);
            
PlayerInfo[playerid][pAdrenaline] += 1;
            }
            case 
1242:
            {
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"You Found Body Armour.");
            
GameTextForPlayer(playerid,"~w~Found Body Armour"50003);
            
SetPlayerArmour(playerid,100);
            }
            case 
1593:
            {
            if (
IsPlayerInAnyVehicle(playerid))
            {
            new 
panelsdoorslightstires,vehicleid GetPlayerVehicleID(playerid);
            
GetVehicleDamageStatus(vehicleidpanelsdoorslightstires);
            
UpdateVehicleDamageStatus(vehicleidpanelsdoorslights15); //Setting tires to 15 will pop them all
            
SendClientMessage(playerid,COLOR_SERVER_HELP_MSG"OOP'S You Got Spiked.");
            
GameTextForPlayer(playerid,"~w~spiked"50003);
            }
            }
        }
        
PlayerInfo[playerid][pPickup][pickupid] = 1;
    }
    if(
pickupid == MoneyBagPickup)
    {
        new 
BagAmount MoneyBagCash;
        
format(stringsizeof(string), "%s (%d) Found The Lost Mafia Money Bag and $%d In %s"PlayerInfo[playerid][pName],playeridBagAmountMoneyBagLocation);
        
SendClientMessageToOthers(playerid,COLOR_SERVER_HELP_MSGstring);
        
format(stringsizeof(string), "You Have Found The Lost Mafia Money Bag and $%d. Keep Your Mouth Shut And You'll Be Fine!",BagAmount);
        
SendClientMessage(playerid,COLOR_SERVER_HELP_MSGstring);
        
format(stringsizeof(string), "~b~%s (%d) ~w~Found The Lost ~p~Mafia Money Bag ~w~and ~g~$%d ~w~In~n~~b~%s"PlayerInfo[playerid][pName],playeridBagAmountMoneyBagLocation);
        
SendClientOnScreenTextToAll(string);
        
format(stringsizeof(string), "~w~Found $%d"BagAmount);
        
GameTextForPlayer(playerid,string50003);
        
DestroyPickup(MoneyBagPickup);
        
GivePlayerMoney(playeridBagAmount);
        
MoneyBagActive 0;
        if (
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)ApplyAnimation(playerid"CARRY""liftup"3.0000001);
        if (
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)PlayerPlaySound(playerid1150XYZ);
    }
    if(
pickupid == LvCityHallEnterPickup)
    {
    
SetPlayerPos(playerid,388.286804173.8516691008.382812);
    
SetPlayerInterior(playerid,3);
    
SetPlayerVirtualWorld(playerid,388);
    
SetPlayerFacingAngle(playerid,89.292861);
    
HouseInfo[Houseid][h_cpbustype]=BUS_TYPE_CITYHALL;
    
HouseInfo[Houseid][h_cptype]=CP_TYPE_ENTRY;
    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSG"{FFFFFF}Welcome To {00AAFF}City Hall{FFFFFF}.  Press The {D6D631}Look Behind Button {FFFFFF}Near The Bot To Buy Items.");
    for (new 
s=0s<12s++)
    {
    
GetPlayerWeaponData(playeridsPlayerInfo[playerid][pWeapon][s],PlayerInfo[playerid][pAmmo][s]);
    }
    
ResetPlayerWeapons(playerid);
    
PlayerInfo[playerid][pReturnWeapons] = 1;
    }
    if(
pickupid == CityHallExitPickup)
    {
    if (
GetPlayerVirtualWorld(playerid) == 388)
    {
    
SetPlayerPos(playerid,416.9494621124.01733310.820312);
    
SetPlayerInterior(playerid,0);
    
SetPlayerVirtualWorld(playerid,0);
    
SetPlayerFacingAngle(playerid,271.265197);
    
HouseInfo[Houseid][h_cpbustype]=0;
    
HouseInfo[Houseid][h_cptype]=CP_TYPE_EXIT;
    
PlayerInfo[playerid][pReturnWeapons] = 1;
    }
    }
    return 
1;

hello guyz i want help.
i've added 2 new pickips CityHallExitPickup And LvCityHallEnterPickup.
But when i pick Any Pickup from 2 new Pickups sometimes i found body armour, sometimes i pick moneybag pickup.
please Help me with this
Reply
#2

Maybe do like this:
pawn Код:
if(pickupid == CityHallExitPickup) {do your stuff...}
//and etc.
EDIT: ow i didn't see that you already done that, my bad.
Reply
#3

i did but when i pick City Hall pickups. then i found random pickups from case::::::
Reply
#4

Then PickupInfo is out of whack somehow.

Get the callback to print out to chat when you enter the pickup. Could also get it to show more info so you can see what it really is picking up.
Reply
#5

Quote:
Originally Posted by danish007
Посмотреть сообщение
i did but when i pick City Hall pickups. then i found random pickups from case::::::
If you manage to fix this issue please be kind enough to post it in my thread (where you got this pickup script from) as i'm having a similar problem
Reply
#6

Quote:
Originally Posted by Ducati
Посмотреть сообщение
If you manage to fix this issue please be kind enough to post it in my thread (where you got this pickup script from) as i'm having a similar problem
Just watch this thread, no need to post in unrelated topics a fix so you don't need to keep an eye out.

Seriously though, it's likely that the co-ordinates in the array are screwed up, or that there's a problem with the code.
Reply
#7

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Just watch this thread, no need to post in unrelated topics a fix so you don't need to keep an eye out.

Seriously though, it's likely that the co-ordinates in the array are screwed up, or that there's a problem with the code.
I said if he manages to fix the problem, not if a solution is posted here. Most people simply abandon their threads once they find a solution rather than posting how they fixed the problem.
The other thread isn't unrelated, its basically the same thread asking for help with the exact same problem. The code posted above is part of the pickups enum I provided in the other thread for others to use for their own purposes (in return for help in fixing the problem).
I don't think its too much to ask for someone to pass the solution along to the person who gave them the code in the first place (in a help request topic) rather than taking the code for their own uses, fixing it and keeping the solution to themselves.

And yes there is a problem with the code, that's why its posted here
Reply
#8

You'll just have to take the risk.


Just because a thread goes necro, doesn't necessarily mean it's solved either... Some people will simply be out of their league and move on, usually blaming the 'help' they got as the reason they left, or the player-base not being there or some shit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)