You don't have to create those pickups and blips every time someone connects.
Adding it on ScriptLoad is fine.
Also, You're using local REDFLAG, which means the variable can only be accessed within the function or signal.
Using the following it will make a global variable which can be accessed from allover your script.
REDFLAG <- CreatePickup( 1321,Vector( 94.92, -962.1, 29.18 ) );
Same goes for the blips.
Then, Your PickedUp signal. There is only 1 thing wrong there.
You're using pPickup.ID (Which is good!) but then comparing it to REDFLAG, which is firstly undefined since it was a local variable, and second its does not return the ID but the instance.
So, Using REDFLAG.ID should work.
Code should be like this, But I didn't tested any of it:
function onScriptLoad( )
{
REDFLAG <- CreatePickup( 1321,Vector( 94.92, -962.1, 29.18 ) );
BLUEFLAG <- CreatePickup( 1321,Vector( 54.44, -566.3, 26.15 ) );
CreateBlip( BLIP_8BALL, 94.92, -962.1, 29.18 );
CreateBlip( BLIP_8BALL, 54.44, -566.3, 26.15 );
print( "Script loaded, And pickups & Blips added." );
return 1;
}
function onPlayerConnect(player)
{
MessagePlayer( "Welcome to the server!", player, 255, 0, 0 );
return 1;
}
function onPickupPickedUp( pPlayer, pPickup )
{
if (pPickup.ID == REDFLAG.ID) // || Team == Blue
{
MessagePlayer( "blah", pPlayer, 255, 0, 0 );
//CreateCheckpoint(0,0,0, 5.0,[BLUE]);
}
else if (pPickup.ID == BLUEFLAG.ID) //|| Team == Blue
{
MessagePlayer("BLAH", pPlayer, 255,0,0);
//CreateCheckpoint(0,0,0, 5.0);
}
return 1;
}
function onPlayerEnterCheckpoint( Player, cp )
{
cp.Remove();
return 1;
}