Player Class does not spawn with weapons?
#1

Hey I made around 32 classes and none of them spawn with weapons?

Here is one of them
Код:
        case 1: { // Los Santos Police Department
            SetPlayerPos(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerCameraPos(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerCameraLookAt(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerColor(playerid, 0x7F7F7FFF); // Gray
            SendClientMessage(playerid, 0x80FF00FF,"Los Santos Police Department!");
            GivePlayerWeapon(playerid, 41, 50000);
            GivePlayerWeapon(playerid, 22, 5000);
            GivePlayerWeapon(playerid, 23, 500);
            GivePlayerWeapon(playerid, 29, 500);
            GivePlayerWeapon(playerid, 43, 500);
            }
why?? Yes I did restart my gamemode and server.
Reply
#2

hi,
try it with AddPlayerClass.
thats easier and alot shorter

pawn Код:
AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);

(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
regards
Reply
#3

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
hi,
try it with AddPlayerClass.
thats easier and alot shorter

pawn Код:
AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0);

(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
regards
Yeah I know this trick but what if my class needs like 7 weps for example not that I have too but I have some with like 5-6 weps
Reply
#4

maybe the problem is that u are giving them weapons of the same slot.

weaponid 22,23 belong both to slot 2
weaponid 41,43 belong to slot 9

See: https://sampwiki.blast.hk/wiki/Weapons

I dont know if that causes the problem but id suggest u to try it out.
For me the GivePlayerWeapon function works well so i dont know why ur isnt working...

regards..
Reply
#5

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
maybe the problem is that u are giving them weapons of the same slot.

weaponid 22,23 belong both to slot 2
weaponid 41,43 belong to slot 9

See: https://sampwiki.blast.hk/wiki/Weapons

I dont know if that causes the problem but id suggest u to try it out.
For me the GivePlayerWeapon function works well so i dont know why ur isnt working...

regards..
Nope it not I just did this
pawn Код:
case 1: { // Los Santos Police Department
            SetPlayerPos(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerCameraPos(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerCameraLookAt(playerid, 1552.6029,-1676.2701,16.1953);
            SetPlayerColor(playerid, 0x7F7F7FFF); // Gray
            SendClientMessage(playerid, 0x80FF00FF,"Los Santos Police Department!");
            GivePlayerWeapon(playerid, 41, 50000);
            //GivePlayerWeapon(playerid, 22, 5000);
            //GivePlayerWeapon(playerid, 23, 500);
            //GivePlayerWeapon(playerid, 29, 500);
            //GivePlayerWeapon(playerid, 43, 500);
and I didnt have any weapons ;/
Reply
#6

mhh,
maybe try it like:

pawn Код:
//OnGameModeInit

AddPlayerClass(299,0,0,0,0,22,100,31,300,16,3); // add skins here with AddPlayerClass
//and give them the first 3 weapons

//OnPlayerRequestSpawn
   

    {
          switch (classid)
    {
            case 0: //first skin u added with AddPLayerClass
            {
                GivePlayerWeapon(yourstuff);
        }

        case 1: //seccond skin and so on...
        {
                 GivePlayerWeapon(yourstuff);
        }

 }
But i see now that this is dump cause i dont know if u can give someone a wapons on the playerrequest.
But its very late now and i have to go to bed
Do u have teams defined or do u want to give every single player different weapons?
Cause if u want to give certain weapons to a certain team do it like this:

pawn Код:
//e.g under OnPlayerSpawn
    {
          switch (gTeam[playerid])
    {
        case 1: //team1
        {

             //Give ur weps here for team1
        }

        case 2: //team2
        {
               //Give ur weps here for team2

        }

 }
To do it like this u need to define the teams first with the gTeam method.
This is explained very well in the wiki.

//edit:
Btw: where did u put ur case function? OnPlayerSpawn?
Its hard to find the problem without the whole code but u can try to put a SendClientMessage there too, to check if ur script is passing trought this code part.
It often happens that u set a wrong } or a return on the wrong place that interrupts ur script and doesnt finish the whole work that is written in ur code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)