OnPlayerSpawn problem
#7

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
Actually, what does it do, not giving weapon, always weapon 24(Deagle), or what, same problem that you mentioned.

Could you try to translate it in different words, I don't really understand when you say:

When I died instantly created
i only get a pistol and here the codes: - can you tell me what is the problem ?
When I come to life only gives me a pistol and not the random weapons ..
And I tried a few times ..

Quote:
Originally Posted by Aveger
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    GivePlayerWeapon(playerid, RandomWeapons[random(sizeof(RandomWeapons))], 500);
    GivePlayerWeapon(playerid, RandomWeapons[random(sizeof(RandomWeapons))], 500);
    GivePlayerWeapon(playerid, RandomWeapons[random(sizeof(RandomWeapons))], 500);
    return 1;
}
I'm not really sure but you can try this also if i remember good
pawn Код:
public OnPlayerSpawn(playerid)
{
    GivePlayerWeapon(playerid, RandomWeapons, 500);
    GivePlayerWeapon(playerid, RandomWeapons, 500);
    GivePlayerWeapon(playerid, RandomWeapons, 500);
    return 1;
}
I Think Should Also work!
No worked ..
pawn Код:
C:\Documents and Settings\User\Desktop\FXP отшлеъ м\TeamWar.pwn(154) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\User\Desktop\FXP отшлеъ м\TeamWar.pwn(155) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\User\Desktop\FXP отшлеъ м\TeamWar.pwn(156) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Quote:
Originally Posted by [FAT]Klabauter[LST]
Посмотреть сообщение
I think that it is giving you pistol every time because it is the first weapon you listed.

I tested this and it works, but it is still possible to get the same weapon more than once.
I don't know how to make it give 3 different weapons every time

PHP код:
stock giverandomweap(playerid)
{
    new 
RandomWeapons random(5);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid24500);
        case 
1: return GivePlayerWeapon(playerid27500);
        case 
3: return GivePlayerWeapon(playerid29500);
        case 
4: return GivePlayerWeapon(playerid31500);
        case 
5: return GivePlayerWeapon(playerid41); // you can't have more than 1 knife
    
}
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
giverandomweap(playerid);
    
giverandomweap(playerid);
    
giverandomweap(playerid);
    return 
1;

I only know how to give a random weapon in each slot, I put assault and rifles together (seemed better that way)
go ahead and use this if you want:

PHP код:
stock giverandompistol(playerid)
{
    new 
RandomWeapons random(3);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid24150);
        case 
1: return GivePlayerWeapon(playerid23250);
        case 
2: return GivePlayerWeapon(playerid22350);
    }
    return 
1;
}
stock giverandomshotty(playerid)
{
    new 
RandomWeapons random(3);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid25300);
        case 
1: return GivePlayerWeapon(playerid27200);
        case 
2: return GivePlayerWeapon(playerid26100);
    }
    return 
1;
}
stock giverandomsmg(playerid)
{
    new 
RandomWeapons random(3);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid28500);
        case 
1: return GivePlayerWeapon(playerid32500);
        case 
2: return GivePlayerWeapon(playerid29500);
    }
    return 
1;
}
stock giverandomrifle(playerid)
{
    new 
RandomWeapons random(4);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid3475);
        case 
1: return GivePlayerWeapon(playerid33200);
        case 
2: return GivePlayerWeapon(playerid30300);
        case 
3: return GivePlayerWeapon(playerid31250);
    }
    return 
1;
}
stock giverandommelee(playerid)
{
    new 
RandomWeapons random(15);
    switch(
RandomWeapons)
    {
        case 
0: return GivePlayerWeapon(playerid11);
        case 
1: return GivePlayerWeapon(playerid21);
        case 
2: return GivePlayerWeapon(playerid31);
        case 
3: return GivePlayerWeapon(playerid41);
        case 
4: return GivePlayerWeapon(playerid51);
        case 
5: return GivePlayerWeapon(playerid61);
        case 
6: return GivePlayerWeapon(playerid71);
        case 
7: return GivePlayerWeapon(playerid81);
        case 
8: return GivePlayerWeapon(playerid91);
        case 
9: return GivePlayerWeapon(playerid101);
        case 
10: return GivePlayerWeapon(playerid111);
        case 
11: return GivePlayerWeapon(playerid121);
        case 
12: return GivePlayerWeapon(playerid131);
        case 
13: return GivePlayerWeapon(playerid141);
        case 
14: return GivePlayerWeapon(playerid151);
    }
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
giverandompistol(playerid);
    
giverandomshotty(playerid);
    
giverandomsmg(playerid);
    
giverandomrifle(playerid);
    
giverandommelee(playerid);
    return 
1;

No worked ..
Reply


Messages In This Thread
OnPlayerSpawn problem - by benel1 - 03.10.2012, 22:09
Re : OnPlayerSpawn problem - by lelemaster - 03.10.2012, 23:57
Re: Re : OnPlayerSpawn problem - by benel1 - 04.10.2012, 00:28
Re : OnPlayerSpawn problem - by lelemaster - 04.10.2012, 02:03
Re: OnPlayerSpawn problem - by SwisherSweet - 04.10.2012, 02:34
Re: OnPlayerSpawn problem - by [FAT]Klabauter[LST] - 04.10.2012, 06:34
Re: OnPlayerSpawn problem - by benel1 - 04.10.2012, 09:41
Re: OnPlayerSpawn problem - by Nirzor - 04.10.2012, 10:02
Re: OnPlayerSpawn problem - by [FAT]Klabauter[LST] - 04.10.2012, 10:09
Re: OnPlayerSpawn problem - by benel1 - 04.10.2012, 11:21

Forum Jump:


Users browsing this thread: 1 Guest(s)