OnPlayerSpawn problem
#6

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;

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)