Why my pickups dont work?
#1

Heey all,

I made some enter interios pickups but they dont work. I added a four second timer so the pickups dont spam.
Код:
//top of script
new City1Exit ;
new City1Enter ;
//ongamemodeinit
SetTimer("OneSecondTimer",1000,1);
City1Enter=CreatePickup(19198,1,-2765.7402,375.5952,6.3347,0);
	City1Exit=CreatePickup(19198,1,389.2351,173.7753,1008.3828,0);
         //onplayerpickup
	HasEnteredPickup[playerid]=4;
	if(HasEnteredPickup[playerid]>0)
	{
	    return 0;
	}
        if(pickupid==City1Enter)
	{
	    SetPlayerPos(playerid,-25.9409,-141.4083,1003.5469);
	    SetPlayerInterior(playerid,16);
	    SetPlayerVirtualWorld(playerid,10012);
	    SendClientMessage(playerid,COLOR_WHITE,"Welcome to the{33CCFF} 24/7{FFFFFF}!");
	    SendClientMessage(playerid,COLOR_WHITE,"To rob this store typ {FFFF00}/robstore{FFFFFF}! To buy some stuff enter the {FF0000}checkpoint{FFFFFF}!");
	    return 1;
	}
	if(pickupid==City1Exit)
	{
 	    SetPlayerPos(playerid,-2420.1565,969.8961,45.2969);
	    SetPlayerInterior(playerid,0);
	    SetPlayerVirtualWorld(playerid,0);
	    //RobbingCityHall[playerid] =0;
	    //SendClientMessage(playerid,COLOR_WHITE,"You Left the{33CCFF} Police Station (SF)!");
	    return 1;
	}
public OneSecondTimer()
{   
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
		if(HasEnteredPickup[i] >= 1)
		{
                     HasEnteredPickup[i] --;
		}
            }
         }
         return 1;
}
Reply
#2

Quote:
Originally Posted by admigo
Посмотреть сообщение
Heey all,

I made some enter interios pickups but they dont work. I added a four second timer so the pickups dont spam.
Код:
//top of script
new City1Exit ;
new City1Enter ;
//ongamemodeinit
SetTimer("OneSecondTimer",1000,1);
City1Enter=CreatePickup(19198,1,-2765.7402,375.5952,6.3347,0);
	City1Exit=CreatePickup(19198,1,389.2351,173.7753,1008.3828,0);
         //onplayerpickup
	HasEnteredPickup[playerid]=4;
	if(HasEnteredPickup[playerid]>0)
	{
	    return 0;
	}
        if(pickupid==Tank1Enter)
	{
	    SetPlayerPos(playerid,-25.9409,-141.4083,1003.5469);
	    SetPlayerInterior(playerid,16);
	    SetPlayerVirtualWorld(playerid,10012);
	    SendClientMessage(playerid,COLOR_WHITE,"Welcome to the{33CCFF} 24/7{FFFFFF}!");
	    SendClientMessage(playerid,COLOR_WHITE,"To rob this store typ {FFFF00}/robstore{FFFFFF}! To buy some stuff enter the {FF0000}checkpoint{FFFFFF}!");
	    return 1;
	}
	if(pickupid==Tank1Exit)
	{
 	    SetPlayerPos(playerid,-2420.1565,969.8961,45.2969);
	    SetPlayerInterior(playerid,0);
	    SetPlayerVirtualWorld(playerid,0);
	    //RobbingCityHall[playerid] =0;
	    //SendClientMessage(playerid,COLOR_WHITE,"You Left the{33CCFF} Police Station (SF)!");
	    return 1;
	}
public OneSecondTimer()
{   
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
		if(HasEnteredPickup[i] >= 1)
		{
                     HasEnteredPickup[i] --;
		}
            }
         }
         return 1;
}
As the pickupid you have Tank1Exit, not City

Check that.
Reply
#3

Quote:
Originally Posted by iGetty
Посмотреть сообщение
As the pickupid you have Tank1Exit, not City

Check that.
Ooh sorry,posted wrong,edited.
The pickups show good but when i walk in it nothing happens.
Reply
#4

I dont see anything wrong in my script.
No errors. Pls help me fix(Rep+)
Reply
#5

Код:
//onplayerpickup
	HasEnteredPickup[playerid]=4;
	if(HasEnteredPickup[playerid]>0)
	{
	    return 0;
	}
You have set HasEnteredPickup[playerid] equal to 4, then immediately check to see if it's greater than 0. It will always return 0 because you just set it to 4.
Reply
#6

Quote:
Originally Posted by Alternative112
Посмотреть сообщение
Код:
//onplayerpickup
	HasEnteredPickup[playerid]=4;
	if(HasEnteredPickup[playerid]>0)
	{
	    return 0;
	}
You have set HasEnteredPickup[playerid] equal to 4, then immediately check to see if it's greater than 0. It will always return 0 because you just set it to 4.
Thanks for Responding,How can i fix this?
Reply
#7

pawn Код:
HasEnteredPickup[playerid]=4;
should be at the end of OnPlayerPickUpPickup.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)