expected token
#10

Quote:
Originally Posted by Mugala
Посмотреть сообщение
okay I have added a weaponid 100, which gives a player health with this code.

SellWeapon(playerid, 5, 100, 50); // for 5 points, 50hp
SellWeapon(playerid, 10, 100, 100); // for 10 points, 100hp
PHP код:
stock SellWeapon(playeridpointsweaponammo)
{
   new 
ppoints GetPlayerPoints(playerid);
   if(
ppoints>=points)
   {
        if(
weapon == 100)
        {
            new 
string[80];
            
GivePlayerPoints(playerid, -points);
            
GetPlayerPoints(playerid);
            
SetPlayerHealth(playerid,ammo);
            
format(stringsizeof(string), "{c3c3c3}* You have bought a %d% health for %i points",ammo,points);
            return 
SendClientMessage(playerid, -1string);
        }
        else
        {
            new 
string[80], weaponname[32];
            
GivePlayerPoints(playerid, -points);
            
GetPlayerPoints(playerid);
            
GivePlayerWeapon(playeridweapon,ammo);
            
GetWeaponName(weaponweaponnamesizeof(weaponname));
            
format(stringsizeof(string), "{c3c3c3}* You have bought %s with %i ammo for %i points"weaponnameammopoints);
            return 
SendClientMessage(playerid, -1string);
        }    
    }
    else
    {
        
SendClientMessage(playerid, -1,"{c3c3c3}* You don't have enough points to buy this item !");
        
ShowPlayerDialog(playerid8DIALOG_STYLE_TABLIST_HEADERS"Market",
        
"Weapon \tPrice \tAmmo \tSlots\n\
        Desert Eagle\t{4286f4}15 Points\t100 \tInfinite\n\
        Shotgun\t{4286f4}10 Points\t40\tInfinite\n\
        Spas\t{4286f4}40 Points\t100\tInfinite\n\
        M4\t{4286f4}10 Points\t90\tInfinite\n\
        Sniper\t{4286f4}30 Points\t30\tInfinite\n\
        Full Health\t{4286f4}150 Points\t-\tInfinite"
,
        
"Buy""Leave");
        return 
1;
    }

wow that's a nice way detect that, however I'm sitting for about 20 minutes trying to figure out how to do so (I've tried few codes didn't really work)

so your code works perfectly it's just that doesn't matter of how much points I have I can still buy it even if its -20
Reply


Messages In This Thread
expected token - by ivndosos - 11.02.2018, 13:46
Re: expected token - by Mugala - 11.02.2018, 14:17
Re: expected token - by ivndosos - 11.02.2018, 14:42
Re: expected token - by Mugala - 11.02.2018, 14:46
Re: expected token - by XxBaDxBoYxX - 11.02.2018, 14:49
Re: expected token - by ivndosos - 11.02.2018, 15:05
Re: expected token - by Mugala - 11.02.2018, 15:12
Re: expected token - by Dayrion - 11.02.2018, 15:23
Re: expected token - by Mugala - 11.02.2018, 15:25
Re: expected token - by ivndosos - 11.02.2018, 15:42

Forum Jump:


Users browsing this thread: 1 Guest(s)