SA-MP Forums Archive
GivePlayerWeapon weird problem - Need Help - 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)
+--- Thread: GivePlayerWeapon weird problem - Need Help (/showthread.php?tid=403619)



GivePlayerWeapon weird problem - Need Help - FL3GM4 - 30.12.2012

under OnPlayerSpawn
i put this:

Код:
	GivePlayerWeapon(playerid, 24, 50);
	GivePlayerWeapon(playerid, 32, 150);
it for first time give weapons to player, but now it doesn't ... why.. i didnt change anything

i tried to turn off junkbuster, but it same problem


Re: GivePlayerWeapon weird problem - Need Help - Dragonborn - 31.12.2012

Try to remember your last modification in GM that caused after this...

Well, have more functions before these in "OnPlayerSpawn" ?


Re: GivePlayerWeapon weird problem - Need Help - FL3GM4 - 31.12.2012

Код:
public OnPlayerSpawn(playerid)
{
	new string[128], Sati, Min, Sec, Godina, Mjesec, Dan;
 	new Random = random(sizeof(RandomSpawns));
	getdate(Godina, Mjesec, Dan);
	gettime(Sati, Min, Sec);
	GivePlayerWeapon(playerid, 24, 50);
	GivePlayerWeapon(playerid, 32, 150);
	SetCameraBehindPlayer(playerid);
	SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
 	SetPlayerHealth(playerid, 100);
	SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
	SetPlayerColor(playerid, COLOR_WHITE);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerFacingAngle(playerid, 180.772293);
	SetPlayerTeam(playerid, 255);
	if(GetPVarInt(playerid, "Prijavljen") == 1)
    {
        GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
        SetPVarInt(playerid, "Prijavljen", 0);
        format(string, sizeof(string), "*Dobrodosao %s na nas server, ljepo te opet vidjeti!", PlayerName(playerid));
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "*Tvoji statsi: Minuta online: [%d]",PlayerInfo[playerid][Minute]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "*Sada je: %d:%dh | Datum: %d.%d.%d", Sati, Min, Dan, Mjesec, Godina);
        SendClientMessage(playerid, COLOR_YELLOW, string);
		if(PlayerInfo[playerid][VIP] == 1)
		{
			format(string, sizeof(string), "*Vi ste V.I.P clan ovog servera", PlayerInfo[playerid][VIP]);
        	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
 			viplabel[playerid] = Create3DTextLabel("V.I.P", COLOR_BLUE, 0.0, 0.0, 0.0, 50.0, -1, 1);
  			Attach3DTextLabelToPlayer(viplabel[playerid], playerid, 0.0, 0.0, 0.6);
		}
		if(PlayerInfo[playerid][pAdmin] > 0)
		{
			format(string, sizeof(string), ".:| Dobrodosao %s, ulogirao si se kao Admin Level %d |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
        	SendClientMessage(playerid, COLOR_OLIVE, string);
        	format(string, sizeof(string), ".:| WS:DM Admin %s, level: %d, je usao na server |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
        	SendAdminMessage(1, COLOR_CHARTREUSE, string);
		}
    }
((...........................))



Re: GivePlayerWeapon weird problem - Need Help - Dragonborn - 31.12.2012

Have some ResetPlayerWeapons on this public ?


Re: GivePlayerWeapon weird problem - Need Help - -=Dar[K]Lord=- - 31.12.2012

Try to put it on top of onplayerspawn.... it might help

pawn Код:
public OnPlayerSpawn(playerid)
{
        GivePlayerWeapon(playerid, 24, 50);
    GivePlayerWeapon(playerid, 32, 150);
    new string[128], Sati, Min, Sec, Godina, Mjesec, Dan;
    new Random = random(sizeof(RandomSpawns));
    getdate(Godina, Mjesec, Dan);
    gettime(Sati, Min, Sec);
    SetCameraBehindPlayer(playerid);
    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerHealth(playerid, 100);
    SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
    SetPlayerColor(playerid, COLOR_WHITE);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerFacingAngle(playerid, 180.772293);
    SetPlayerTeam(playerid, 255);
    if(GetPVarInt(playerid, "Prijavljen") == 1)
    {
        GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
        SetPVarInt(playerid, "Prijavljen", 0);
        format(string, sizeof(string), "*Dobrodosao %s na nas server, ljepo te opet vidjeti!", PlayerName(playerid));
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "*Tvoji statsi: Minuta online: [%d]",PlayerInfo[playerid][Minute]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "*Sada je: %d:%dh | Datum: %d.%d.%d", Sati, Min, Dan, Mjesec, Godina);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        if(PlayerInfo[playerid][VIP] == 1)
        {
            format(string, sizeof(string), "*Vi ste V.I.P clan ovog servera", PlayerInfo[playerid][VIP]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            viplabel[playerid] = Create3DTextLabel("V.I.P", COLOR_BLUE, 0.0, 0.0, 0.0, 50.0, -1, 1);
            Attach3DTextLabelToPlayer(viplabel[playerid], playerid, 0.0, 0.0, 0.6);
        }
        if(PlayerInfo[playerid][pAdmin] > 0)
        {
            format(string, sizeof(string), ".:| Dobrodosao %s, ulogirao si se kao Admin Level %d |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
            SendClientMessage(playerid, COLOR_OLIVE, string);
            format(string, sizeof(string), ".:| WS:DM Admin %s, level: %d, je usao na server |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
            SendAdminMessage(1, COLOR_CHARTREUSE, string);
        }
    }



Re: GivePlayerWeapon weird problem - Need Help - FL3GM4 - 31.12.2012

Quote:
Originally Posted by Dragonborn
Посмотреть сообщение
Have some ResetPlayerWeapons on this public ?
there is no any "ResetPlayerWeapons"

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
Try to put it on top of onplayerspawn.... it might help

pawn Код:
public OnPlayerSpawn(playerid)
{
        GivePlayerWeapon(playerid, 24, 50);
    GivePlayerWeapon(playerid, 32, 150);
    new string[128], Sati, Min, Sec, Godina, Mjesec, Dan;
    new Random = random(sizeof(RandomSpawns));
    getdate(Godina, Mjesec, Dan);
    gettime(Sati, Min, Sec);
    SetCameraBehindPlayer(playerid);
    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerHealth(playerid, 100);
    SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
    SetPlayerColor(playerid, COLOR_WHITE);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerFacingAngle(playerid, 180.772293);
    SetPlayerTeam(playerid, 255);
    if(GetPVarInt(playerid, "Prijavljen") == 1)
    {
        GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
        SetPVarInt(playerid, "Prijavljen", 0);
        format(string, sizeof(string), "*Dobrodosao %s na nas server, ljepo te opet vidjeti!", PlayerName(playerid));
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "*Tvoji statsi: Minuta online: [%d]",PlayerInfo[playerid][Minute]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "*Sada je: %d:%dh | Datum: %d.%d.%d", Sati, Min, Dan, Mjesec, Godina);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        if(PlayerInfo[playerid][VIP] == 1)
        {
            format(string, sizeof(string), "*Vi ste V.I.P clan ovog servera", PlayerInfo[playerid][VIP]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            viplabel[playerid] = Create3DTextLabel("V.I.P", COLOR_BLUE, 0.0, 0.0, 0.0, 50.0, -1, 1);
            Attach3DTextLabelToPlayer(viplabel[playerid], playerid, 0.0, 0.0, 0.6);
        }
        if(PlayerInfo[playerid][pAdmin] > 0)
        {
            format(string, sizeof(string), ".:| Dobrodosao %s, ulogirao si se kao Admin Level %d |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
            SendClientMessage(playerid, COLOR_OLIVE, string);
            format(string, sizeof(string), ".:| WS:DM Admin %s, level: %d, je usao na server |:.", PlayerName(playerid), PlayerInfo[playerid][pAdmin]);
            SendAdminMessage(1, COLOR_CHARTREUSE, string);
        }
    }
I tried, it didn't help


Re: GivePlayerWeapon weird problem - Need Help - iggy1 - 31.12.2012

Well really giving the weapons at the top should work as it's the first thing called and not under any if statement. An alternative would be using SetSpawnInfo BEFORE OnPlayerSpawn is called.


Re: GivePlayerWeapon weird problem - Need Help - Konstantinos - 31.12.2012

It gives the weapons you've set in AddPlayerClass, or SetSpawnInfo. Something that may works is the following. In OnPlayerSpawn, reset the weapons and give these two.
pawn Код:
GivePlayerWeapon(playerid, 24, 50);
GivePlayerWeapon(playerid, 32, 150);



Re: GivePlayerWeapon weird problem - Need Help - FL3GM4 - 31.12.2012

i tried with setspawninfo and it didnt help to me...

any why I choosing skins on connect, but if I choose any skin, it spawn me with CJ's skin !?


Re: GivePlayerWeapon weird problem - Need Help - iggy1 - 31.12.2012

Unload ALL of your scripts except the one you are testing, and re-test it. You may have code in other scripts messing it up, that's what it sounds like to me.