Only giving weapons to ID 0
#1

I've been having problems with spawning weapons and this is the latest. Just as I thought everything was working, my friend logged on and it didn't give him weapons. Eventually we figured out that only ID 0 was getting weapons. Can anyone help me?

Code:

OnPlayerSpawn I have this:

pawn Код:
if(PlayerInfo[playerid][New] == 0)
        {
            SetTimer("newweapons", 1000, false);
            PlayerInfo[playerid][New] = 1;
        }

and at the timer the code is:

pawn Код:
public newweapons(playerid)
{
    if (gTeam[playerid] == TEAM_LSPD)
    {
        GivePlayerWeapon(playerid, 29, 500);
        GivePlayerWeapon(playerid, 22, 9999);
    }
    else
    {
        GivePlayerWeapon(playerid, 28, 1000);
        GivePlayerWeapon(playerid, 22, 9999);
    }
    return 1;
}
Reply
#2

Ugh, shouldn't that be SetTimerEx?
Reply
#3

Hmm Ok. I don't really understand SetTimerEx so if you could give me an example I would appreciate it.
Reply
#4

Thanks! It works!

One more problem though, I've set the player skill to 0 for the correct weapon but on his screen he spawns with 2 colts and on mine he only has 1? Whats gone wrong?
Reply
#5

Quote:
Originally Posted by cloudysky
Посмотреть сообщение
Thanks! It works!

One more problem though, I've set the player skill to 0 for the correct weapon but on his screen he spawns with 2 colts and on mine he only has 1? Whats gone wrong?
Not sure about your problem I quoted, but you really shouldn't be using a timer for that unless it's completely needed. You could easily do:

pawn Код:
if(PlayerInfo[playerid][New] == 0)
{
    if (gTeam[playerid] == TEAM_LSPD)
    {
        GivePlayerWeapon(playerid, 29, 500);
        GivePlayerWeapon(playerid, 22, 9999);
    }
    else
    {
        GivePlayerWeapon(playerid, 28, 1000);
        GivePlayerWeapon(playerid, 22, 9999);
    }
    PlayerInfo[playerid][New] = 1;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)