Only giving weapons to ID 0 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Only giving weapons to ID 0 (
/showthread.php?tid=267991)
Only giving weapons to ID 0 -
cloudysky - 10.07.2011
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;
}
Re: Only giving weapons to ID 0 -
Libra_PL - 10.07.2011
Ugh, shouldn't that be SetTimerEx?
Re: Only giving weapons to ID 0 -
cloudysky - 10.07.2011
Hmm Ok. I don't really understand SetTimerEx so if you could give me an example I would appreciate it.
Re: Only giving weapons to ID 0 -
cloudysky - 10.07.2011
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?
Re: Only giving weapons to ID 0 -
Skylar Paul - 10.07.2011
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;
}