Spectating random player | OnPlayerPickUpPickUp
#1

So i have problems with 2 thing: spectating and onplayerpickuppickup

(1) The SendClientMessage not appearing !

So when i pick up the pick up nothing happens ...

Above the script:
pawn Код:
new info1, info2, info3, info10;
OnPlayerPickUpPickUp:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == info1) SendClientMessage(playerid,COLOR_BLUE,"[INFO] /opengarage | /closegarage");

    if(pickupid == info2) SendClientMessage(playerid,COLOR_BLUE,"[INFO] /open | /close");

    if(pickupid == info3) SendClientMessage(playerid,COLOR_BLUE,"[INFO] /open | /close");
   
    if(pickupid == info10) SendClientMessage(playerid, COLOR_RED,"[INFO] /open | /close");
   
    return 1;
}
(2) Random Spectate don't work.

[DERBY SERVER] So when someone want to spawn and if the round is still ... in progress. (s)he has to spectate other cars. IF !

Above:
pawn Код:
new CarMap1[30],CarMap2[31], CarMap3[31];
OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
        if(EndRoundCounter != 0)
        {

            SendClientMessage(playerid, COLOR_RED,"Sorry, you can't join while the round is in progress, you have to wait ...");
            SendClientMessage(playerid, COLOR_ORANGE,"While you have to wait, you can specate the ADMIN !");
            GameTextForPlayer(playerid, "~y~Round in progress ...", 1250, 3);
            TogglePlayerSpectating(playerid, 1);
            PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playerid), SPECTATE_MODE_NORMAL);//THIS

        }
        else
        {
           for(new i; i<MAX_PLAYERS; i++)
           {
                SendClientMessage(playerid, COLOR_WHITE,"You are a derby member ! You play the derby and fight against other cars/players !");
                SendClientMessage(playerid, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendClientMessage(playerid, COLOR_WHITE,"Take a look to /derbycmds and if you want to start : wait for the countdown !");
              new rand1=random(30);
              if(!IsPlayerInVehicle(i, CarMap1[rand1])) return PutPlayerInVehicle(playerid, CarMap1[rand1], 0);
               
           }
        }
return 1;
}
Plz help me !?
Reply
#2

pawn Код:
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playerid), SPECTATE_MODE_NORMAL);//THIS
- You are trying to spectate your vehicle, not another player's vehicle.
Reply
#3

Quote:
Originally Posted by _Tommy
Посмотреть сообщение
pawn Код:
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playerid), SPECTATE_MODE_NORMAL);//THIS
- You are trying to spectate your vehicle, not another player's vehicle.
Ow >_< yeah but how i must be then ?!
Reply
#4

Use foreach.
https://sampforum.blast.hk/showthread.php?tid=92679
It has the function that you need:
pawn Код:
new randomplayer = Iter_Random(Player);
The message won't appear because the random player can be a player not connected.
Reply
#5

Why the hell did you add forward OnPlayerPickUpPickUp(playerid, pickupid); ? It's already added in a_samp...
Delete it, and it will work fine...
Also, make sure you have put the pickupid infront of the pickup:
pawn Код:
info1 = CreatePickup( ... );
Reply
#6

Quote:
Originally Posted by Mean
Посмотреть сообщение
Why the hell did you add forward OnPlayerPickUpPickUp(playerid, pickupid); ? It's already added in a_samp...
Delete it, and it will work fine...
Also, make sure you have put the pickupid infront of the pickup:
pawn Код:
info1 = CreatePickup( ... );
If i delete the line i get this:

Код:
C:\Users\Michael\Desktop\GTA\Eigen server\gamemodes\PAT.pwn(1336) : warning 235: public function lacks forward declaration (symbol "OnPlayerPickUpPickUp")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
And yes i have this:
pawn Код:
info1 = AddStaticPickup(1239,3, -1621.9841,683.9534,7.1875);
info2 = AddStaticPickup(1239,3, -1575.1346,657.3049,7.1901);
info3 = AddStaticPickup(1239,3, -1697.7852,688.9707,24.8906);
info10 = AddStaticPickup(1239,3, -2705.1042,401.3816,4.3672);
Reply
#7

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
You don't need to forward this callback.
Pay attention to big and small letters.
Reply
#8

Quote:
Originally Posted by Serbish
Посмотреть сообщение
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
You don't need to forward this callback.
Pay attention to big and small letters.
Yes i have that ! OnPlayerPickUpPickUp(playerid, pickupid) but when i delete the forward line i get this :
Код:
C:\Users\Michael\Desktop\GTA\Eigen server\gamemodes\PAT.pwn(1336) : warning 235: public function lacks forward declaration (symbol "OnPlayerPickUpPickUp")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
It is a warning but i don't want warnings/errors.
Reply
#9

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Yes i have that ! OnPlayerPickUpPickUp(playerid, pickupid) but when i delete the forward line i get this :
Код:
C:\Users\Michael\Desktop\GTA\Eigen server\gamemodes\PAT.pwn(1336) : warning 235: public function lacks forward declaration (symbol "OnPlayerPickUpPickUp")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
It is a warning but i don't want warnings/errors.
No! Put attention to big laters!
pawn Код:
OnPlayerPickUpPickUp
pawn Код:
OnPlayerPickUpPickup
The second on is the good one.
Reply
#10

Quote:
Originally Posted by _Tommy
Посмотреть сообщение
No! Put attention to big laters!
pawn Код:
OnPlayerPickUpPickUp
pawn Код:
OnPlayerPickUpPickup
The second on is the good one.
Ow >_< God damn it, now i see it : OnPlayerPickUpPickup
Lol thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)