The more score the more guns
#1

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.
Reply
#2

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?
Reply
#3

Bump
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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

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
Reply
#8

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;
Reply
#9

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;
}
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)