SA-MP Forums Archive
The more score the more guns - 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: The more score the more guns (/showthread.php?tid=289005)



The more score the more guns - Garc1a - 09.10.2011

I'm using Zadmin and I need help because I want to make it so that if a player has 100 score, they have a certain gun, and if they have 200 score they have a certain gun etc.

I have no idea on how to do this so I hope you can help.

I know that Zadmin saves score.


Re: The more score the more guns - Garc1a - 10.10.2011

Quote:
Originally Posted by Las Venturas CNR
Посмотреть сообщение
Underneath the OnPlayerSpawn callback, create something like:

pawn Код:
switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
    {
        case 0..5: GivePlayerWeapon(playerid, 24, 1000); // If the user's score is 0 -5, we'll give them a Desert Eagle. (1000 Ammo)
        case 6..50: GivePlayerWeapon(playerid, 31, 1000); // If the user's score is 6 - 50, we'll give them an M4 carbine. (1000 Ammo)
        case 51..9999: GivePlayerWeapon(playerid, 38, 1000); // If the user's score is 51 through 9999, we'll give them a Rotary Cannon. (1000 Ammo)
    }

ZAdmin shouldn't matter as this is just getting the user's score.

wiki.sa-mp.com/wiki/Weapons <--- Weapon ID's.
wiki.sa-mp.com/wiki/Function:GivePlayerWeapon <--- GivePlayerWeapon function.
wiki.sa-mp.com/wiki/Control_Structures#switch_2 <--- Switch statement information.
How do I give them multiple guns?


Re: The more score the more guns - Garc1a - 10.10.2011

Bump


Re: The more score the more guns - grand.Theft.Otto - 10.10.2011

pawn Код:
switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
{
    case 0..5:
    {
        GivePlayerWeapon(playerid, 24, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 6..50:
    {
        GivePlayerWeapon(playerid, 31, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 51..9999:
    {
        GivePlayerWeapon(playerid, 38, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    return 1;
}



Re: The more score the more guns - Garc1a - 10.10.2011

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
pawn Код:
switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
{
    case 0..5:
    {
        GivePlayerWeapon(playerid, 24, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 6..50:
    {
        GivePlayerWeapon(playerid, 31, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 51..9999:
    {
        GivePlayerWeapon(playerid, 38, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    return 1;
}
Gives me this:

Код:
C:\Users\Johnny\Desktop\utdm - Copy - Copy - Copy\gamemodes\UTDM.pwn(349) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Johnny\Desktop\utdm - Copy - Copy - Copy\gamemodes\UTDM.pwn(349) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: The more score the more guns - grand.Theft.Otto - 10.10.2011

Show me the line or part of code in your script where you're putting my block of code.


Re: The more score the more guns - Laronic - 10.10.2011

Quote:
Originally Posted by Garc1a
Посмотреть сообщение
Gives me this:

Код:
C:\Users\Johnny\Desktop\utdm - Copy - Copy - Copy\gamemodes\UTDM.pwn(349) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Johnny\Desktop\utdm - Copy - Copy - Copy\gamemodes\UTDM.pwn(349) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Try to remove the "return 1;" inside the switch


Re: The more score the more guns - Garc1a - 10.10.2011

I don't understand.. this is the code:

Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
    switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
    {
    case 0..5:
    {
    GivePlayerWeapon(playerid, 24, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 6..50:
    {
    GivePlayerWeapon(playerid, 31, 1000);
        // multiple other weapons
        // multiple other weapons
    }
    case 51..9999:
    {
    GivePlayerWeapon(playerid, 38, 1000);
        // multiple other weapons
        // multiple other weapons
    }
	return 1;
}
The errors are coming from return 1;


Re: The more score the more guns - Laronic - 10.10.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
    switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
    {
        case 0..5:
        {
            GivePlayerWeapon(playerid, 24, 1000);
            // multiple other weapons
            // multiple other weapons
        }
        case 6..50:
        {
            GivePlayerWeapon(playerid, 31, 1000);
            // multiple other weapons
            // multiple other weapons
        }
        case 51..9999:
        {
            GivePlayerWeapon(playerid, 38, 1000);
            // multiple other weapons
            // multiple other weapons
        }
    }
    return 1;
}



Re: The more score the more guns - Garc1a - 10.10.2011

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
    switch(GetPlayerScore(playerid)) // Get the user's score for the switch.
    {
        case 0..5:
        {
            GivePlayerWeapon(playerid, 24, 1000);
            // multiple other weapons
            // multiple other weapons
        }
        case 6..50:
        {
            GivePlayerWeapon(playerid, 31, 1000);
            // multiple other weapons
            // multiple other weapons
        }
        case 51..9999:
        {
            GivePlayerWeapon(playerid, 38, 1000);
            // multiple other weapons
            // multiple other weapons
        }
    }
    return 1;
}
Ahaa, thanks, amazing how much one bracket can do.