Help (Case random)
#1

I have this command, this command will help people craft weapon. But i want make it more roleplay, so it's will be random fail or success when craft a weapon. But i dont know everything about.. so please help me to make it for a random
Thanks you for watch and your help at first
command:
PHP код:
CMD:chetaosung(playerid, params[])
{
    if(!
IsPlayerInRangeOfPoint(playerid, 20, 2266.2012,-1588.1500,1494.1938))
    return 
SendClientMessageEx(playerid, COLOR_GREY, "Ban khong o trong nha may che tao sung.");
    new 
string[128];
    if(
HungerPlayerInfo[playerid][hgInEvent] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "   You cannot do this while being in the Hunger Games Event!");
    if(
GetPVarInt(playerid, "IsInArena") >= 0) {
        
SendClientMessageEx(playerid,COLOR_GREY,"   You cannot do this while being in a arena!");
        return 
1;
    }
       if(
GetPVarInt( playerid, "EventToken") != 0)
    {
        
SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
        return 
1;
    }
    if (
PlayerInfo[playerid][pJob] != 9 && PlayerInfo[playerid][pJob2] != 9) {
        
SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong phai la Arms Dealer!");
        return 
1;
    }
    if(
WatchingTV[playerid] != 0) {
        
SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
        return 
1;
    }
    if (
PlayerInfo[playerid][pScrewdriver] == 0) {
        
SendClientMessageEx(playerid,COLOR_GREY,"   Ban can mot chiec tua vit tu Nguoi Che Tao (craftsman) de tao sung!");
        return 
1;
    }
    if (
PlayerInfo[playerid][pJailTime] > 0) {
        
SendClientMessageEx(playerid,COLOR_GREY,"   You can not make guns while in jail or prison!");
        return 
1;
    }
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu do vao luc nay.");
    if (
GetPVarInt(playerid, "ArmsTimer") > 0) {
        
format(string, sizeof(string), "   Ban phai doi %d giay nua truoc khi ban co the ban vu khi khac.", GetPVarInt(playerid, "ArmsTimer"));
        
SendClientMessageEx(playerid,COLOR_GREY,string);
        return 
1;
    }
    if(
PlayerInfo[playerid][pHospital] > 0) {
        
SendClientMessageEx(playerid, COLOR_GREY, "You can't spawn a weapon whilst in Hospital.");
        return 
1;
    }
    new 
giveplayerid,x_weapon[20],weapon,price,storageid;
    
/*// Find the storageid of the storagedevice.
    new bool:itemEquipped = false;
    for(new i = 0; i < 3; i++)
    {
        if(StorageInfo[playerid][i][sAttached] == 1) {
            storageid = i;
            itemEquipped = true;
        }
    }
    if(itemEquipped == false) return SendClientMessageEx(playerid, COLOR_WHITE, "ban khong co a storage device equipped! - /storagehelp");
    */
    
if(sscanf(params, "us[20]", giveplayerid, x_weapon)) {
        
SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
        
SendClientMessageEx(playerid, COLOR_YELLOW, "<< Available weapons >>");
        new 
level = PlayerInfo[playerid][pArmsSkill];
        if(
level >= 0 && level < 50) {
            
SendClientMessageEx(playerid, COLOR_GRAD1, "sdpistol(100)    flowers(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "9mm(150)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "shotgun(200)    knuckles(25)");
        }
        else if(
level >= 50 && level < 100) {
            
SendClientMessageEx(playerid, COLOR_GRAD1, "sdpistol(100)    flowers(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "9mm(150)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "shotgun(200)    knuckles(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "mp5(400)        baseballbat(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "rifle(1000)        cane(25)");
        }
        else if(
level >= 100 && level < 200) {
            
SendClientMessageEx(playerid, COLOR_GRAD1, "sdpistol(100)    flowers(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "9mm(150)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "shotgun(200)    knuckles(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "mp5(400)        baseballbat(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "rifle(1000)        cane(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "deagle(8000)    shovel(25)");
        }
        else if(
level >= 200 && level < 400) {
            
SendClientMessageEx(playerid, COLOR_GRAD1, "sdpistol(100)    flowers(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "9mm(150)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "shotgun(200)    knuckles(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "mp5(400)           baseballbat(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "rifle(1000)        cane(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "deagle(8000)    shovel(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "golfclub(25)    poolcue(25)");
        }
        else if(
level >= 400) {
            
SendClientMessageEx(playerid, COLOR_GRAD1, "sdpistol(100)    flowers(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "shotgun(200)    knuckles(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "mp5(400)        baseballbat(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "rifle(1000)        cane(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "deagle(8000)    shovel(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "golfclub(25)    poolcue(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "dildo(25)        katana(25)");
            
SendClientMessageEx(playerid, COLOR_GRAD1, "uzi(1250)      tec9(1250)");
        }
        if(
PlayerInfo[playerid][pDonateRank] >= 3)
        {
               
SendClientMessageEx(playerid, COLOR_YELLOW, "Gold+ VIP Feature: AK-47(10000)");
        }
        
SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
        
SendClientMessageEx(playerid, COLOR_GREY, "SUDUNG: /sellgun [player] [weaponname]");
        return 
1;
    }
    if(!
IsPlayerConnected(giveplayerid)) {
        return 
SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi khong hop le.");
    }
    if(
HungerPlayerInfo[giveplayerid][hgInEvent] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "   This person is not able to receive weapons at the moment.");
    if(
strcmp(x_weapon,"dildo",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 400) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 10; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"katana",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 400) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 8; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"ak47",true) == 0) {
        if(
PlayerInfo[playerid][pDonateRank] < 3) return SendClientMessageEx(playerid, COLOR_GREY, " Ban khong phai la Gold VIP+!");
        if(
PlayerInfo[playerid][pMats] >= 10000) {
            
weapon = 30; price = 10000;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"golfclub",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 200) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 2; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"poolcue",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 200) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 7; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"shovel",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 100) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 6; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"cane",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 50) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 15; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"baseballbat",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 50) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 5; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"knuckles",true) == 0) {
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 1; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"sdpistol",true) == 0) {
        if(
PlayerInfo[playerid][pMats] > 99) {
            
weapon = 23; price = 100;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"flowers",true) == 0) {
        if(
PlayerInfo[playerid][pMats] > 24) {
            
weapon = 14; price = 25;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"deagle",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 100) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 7999) {
            
weapon = 24; price = 8000;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"mp5",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 50) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 399) {
            
weapon = 29; price = 400;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   khong du Materials cho viec do Weapon!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"uzi",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 400) return SendClientMessageEx(playerid, COLOR_GREY, "ban khong a high enough level to craft this item!");
        if(
PlayerInfo[playerid][pMats] > 1249) {
            
weapon = 28; price = 1250;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"tec9",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 400) return SendClientMessageEx(playerid, COLOR_GREY, "ban khong a high enough level to craft this item!");
        if(
PlayerInfo[playerid][pMats] > 1249) {
            
weapon = 32; price = 1250;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"shotgun",true) == 0) {
        if(
PlayerInfo[playerid][pMats] > 199) {
            
weapon = 25; price = 200;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"9mm",true) == 0) {
        if(
PlayerInfo[playerid][pMats] > 149) {
            
weapon = 22; price = 150;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else if(
strcmp(x_weapon,"rifle",true) == 0) {
        if(
PlayerInfo[playerid][pArmsSkill] < 50) return SendClientMessageEx(playerid, COLOR_GREY, " You are not the required level to create that!");
        if(
PlayerInfo[playerid][pMats] > 999) {
            
weapon = 33; price = 1000;
        }
        else {
            
SendClientMessageEx(playerid,COLOR_GREY,"   Khong du Vat Lieu (Materials) de che tao sung!");
            return 
1;
        }
    }
    else { 
SendClientMessageEx(playerid,COLOR_GREY,"   Invalid Weapon name!"); return 1; }
    if (
ProxDetectorS(5.0, playerid, giveplayerid)) {
        if(
PlayerInfo[giveplayerid][pConnectHours] < 2 || PlayerInfo[giveplayerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "That person is currently restricted from possessing weapons!");
        if(
giveplayerid == playerid) {
            
format(string, sizeof(string), "   ban da given yourself a %s.", x_weapon);
            
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            
SendClientMessageEx(playerid, COLOR_GRAD1, string);
            
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            switch( 
PlayerInfo[playerid][pSex] ) {
                case 
1: format(string, sizeof(string), "* %s da che tao mot khau sung tu Vat Lieu (Materials), va dua no cho anh ta.", GetPlayerNameEx(playerid));
                case 
2: format(string, sizeof(string), "* %s created a Gun from Materials, and hands it to herself.", GetPlayerNameEx(playerid));
            }
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
GivePlayerValidWeapon(playerid,weapon,30);
            
PlayerInfo[playerid][pMats] -= price;
            if(
weapon > 15)
            {
                if(
PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
                 {
                      
PlayerInfo[playerid][pArmsSkill] += 2;
                 }
                else if(
DoubleXP) {
                    
SendClientMessageEx(playerid, COLOR_YELLOW, "Ban da nhan duoc 2 diem ki nang che sung thay vi 1. (Double XP Active)");
                    
PlayerInfo[playerid][pArmsSkill] += 2;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
                }
                  else if(
PlayerInfo[playerid][pDoubleEXP] > 0 && PlayerInfo[playerid][pDonateRank] < 2 && !DoubleXP)
                {
                    
format(string, sizeof(string), "Ban da nhan duoc 2 diem ki nang che sung thay vi 1. Ban con %d tieng con lai trong Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
                    
SendClientMessageEx(playerid, COLOR_YELLOW, string);
                    
PlayerInfo[playerid][pArmsSkill] += 2;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
                }
                 else
                  {
                      
PlayerInfo[playerid][pArmsSkill]++;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE;
                   }
            }
            if(
PlayerInfo[playerid][pAdmin] < 3) {
                
SetPVarInt(playerid, "ArmsTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_ARMSTIMER);
            }
            if(
PlayerInfo[playerid][pArmsSkill] == 50)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 2, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 100)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 3, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 200)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 4, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 400)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 5, ban se che tao sung duoc nhieu sung hon."); }
            return 
1;
        }
        
format(string, sizeof(string), "* You offered %s to buy a %s.", GetPlayerNameEx(giveplayerid), x_weapon);
        
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        
format(string, sizeof(string), "* Nguoi che tao sung %s muon ban cho ban mot %s, (go /chapnhan gun) de mua.", GetPlayerNameEx(playerid), x_weapon);
        
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
        
GunOffer[giveplayerid] = playerid;
        
GunStorageID[giveplayerid] = storageid;
        
GunId[giveplayerid] = weapon;
        
GunMats[giveplayerid] = price;
         
SetPVarInt(giveplayerid, "WeaponSeller_SQLId", GetPlayerSQLId(playerid));
        if(
PlayerInfo[playerid][pAdmin] < 3) {
            
SetPVarInt(playerid, "ArmsTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_ARMSTIMER);
        }
    }
    else
    {
        
SendClientMessageEx(playerid, COLOR_GREY, "Nguoi choi do khong o gan ban.");
        return 
1;
    }
    return 
1;
} 
I want to switch and radom in 2 case:
case 1
PHP код:
     if(giveplayerid == playerid) {
            
format(string, sizeof(string), "   ban da given yourself a %s.", x_weapon);
            
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            
SendClientMessageEx(playerid, COLOR_GRAD1, string);
            
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            switch( 
PlayerInfo[playerid][pSex] ) {
                case 
1: format(string, sizeof(string), "* %s da che tao mot khau sung tu Vat Lieu (Materials), va dua no cho anh ta.", GetPlayerNameEx(playerid));
                case 
2: format(string, sizeof(string), "* %s created a Gun from Materials, and hands it to herself.", GetPlayerNameEx(playerid));
            }
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
GivePlayerValidWeapon(playerid,weapon,30);
            
PlayerInfo[playerid][pMats] -= price;
            if(
weapon > 15)
            {
                if(
PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
                 {
                      
PlayerInfo[playerid][pArmsSkill] += 2;
                 }
                else if(
DoubleXP) {
                    
SendClientMessageEx(playerid, COLOR_YELLOW, "Ban da nhan duoc 2 diem ki nang che sung thay vi 1. (Double XP Active)");
                    
PlayerInfo[playerid][pArmsSkill] += 2;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
                }
                  else if(
PlayerInfo[playerid][pDoubleEXP] > 0 && PlayerInfo[playerid][pDonateRank] < 2 && !DoubleXP)
                {
                    
format(string, sizeof(string), "Ban da nhan duoc 2 diem ki nang che sung thay vi 1. Ban con %d tieng con lai trong Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
                    
SendClientMessageEx(playerid, COLOR_YELLOW, string);
                    
PlayerInfo[playerid][pArmsSkill] += 2;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE * 2;
                }
                 else
                  {
                      
PlayerInfo[playerid][pArmsSkill]++;
                    
PlayerInfo[playerid][pXP] += PlayerInfo[playerid][pLevel] * XP_RATE;
                   }
            }
            if(
PlayerInfo[playerid][pAdmin] < 3) {
                
SetPVarInt(playerid, "ArmsTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_ARMSTIMER);
            }
            if(
PlayerInfo[playerid][pArmsSkill] == 50)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 2, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 100)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 3, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 200)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 4, ban se che tao sung duoc nhieu sung hon."); }
            else if(
PlayerInfo[playerid][pArmsSkill] == 400)
            { 
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ki nang che tao sung cua ban da len level 5, ban se che tao sung duoc nhieu sung hon."); }
            return 
1;
        }
        
format(string, sizeof(string), "* You offered %s to buy a %s.", GetPlayerNameEx(giveplayerid), x_weapon);
        
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        
format(string, sizeof(string), "* Nguoi che tao sung %s muon ban cho ban mot %s, (go /chapnhan gun) de mua.", GetPlayerNameEx(playerid), x_weapon);
        
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
        
GunOffer[giveplayerid] = playerid;
        
GunStorageID[giveplayerid] = storageid;
        
GunId[giveplayerid] = weapon;
        
GunMats[giveplayerid] = price;
         
SetPVarInt(giveplayerid, "WeaponSeller_SQLId", GetPlayerSQLId(playerid));
        if(
PlayerInfo[playerid][pAdmin] < 3) {
            
SetPVarInt(playerid, "ArmsTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_ARMSTIMER);
        } 
case 2
PHP код:
PlayerInfo[playerid][pMats] -= price;
SendClientMessageEx(playerid, COLOR_YELLOW, "* Ban da that bai trong viec che tao sung :p."); 
Reply
#2

I don't wanna dig into your code but I'll show you how to do what you want to do and you can simply implement it where you want.
pawn Код:
new chance = random(1); //can be 0, or 1
switch(chance)
{
    case 0:
    {
        //50% chance
    }
    case 1:
    {
        //50% chance
    }
}
or you could do something like this:
pawn Код:
new chance = random(3); //0, 1, 2, 3
switch(chance)
{
    case 0:
    {
        //25% chance
    }
    default:
    {
        //75% chance
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)