Raised This Month: $51 Target: $400
 12% 

add message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Joker2020
Junior Member
Join Date: Aug 2020
Old 08-31-2020 , 05:24   add message
Reply With Quote #1

how do I make it clear that the weapon is available from round 2?

Code:
if(get_user_flags(id) & ACCESS_FLAG)
	{
	if(g_RoundNum >= 2)

        {
		drop_weapons(id, 1);
		IsUserHaveAwp[id] = true;
		give_item_ex2(id, "weapon_awp", 30, true, IMPULSE);
	}else client_print(id, print_center, "available only to VIP players!");
    }
}
I tried it like this but it doesn't work
Code:
else
    {
            client_print(id, print_center, "available from round 2!");
	if(g_RoundNum >= 2)

Last edited by Joker2020; 08-31-2020 at 05:25.
Joker2020 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 08-31-2020 , 09:08   Re: add message
Reply With Quote #2

Code:
if(get_user_flags(id) & ACCESS_FLAG && g_RoundNum >= 2 )                      /*Give VIP AWP round 2 and beyond*/     {                        drop_weapons(id, 1);         IsUserHaveAwp[id] = true;         give_item_ex2(id, "weapon_awp", 30, true, IMPULSE);     }         if( !(get_user_flags(id)&ACCESS_FLAG) && g_RoundNum >= 2 )                                                        /*NON-VIP*/             client_print(id, print_center, "available only to VIP players!");                 else                                             /*ROUND 1 MSG TO BE CLEAR ABOUT*/                     client_print(id, print_center, "available from round 2!");
__________________

Last edited by DJEarthQuake; 09-01-2020 at 15:18. Reason: Added notes. Upload/paste entire script if further help is needed please.
DJEarthQuake is offline
anakonda001
Member
Join Date: Jul 2020
Old 08-31-2020 , 14:17   Re: add message
Reply With Quote #3

and this is where
client_print(id, print_center, "available from round 2!");
anakonda001 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-31-2020 , 19:15   Re: add message
Reply With Quote #4

DJEarthQuake's code is quite wrong but your original code is very close to being correct. Where you currently have "available only to VIP players!" you should put "available from round 2!". Then, you need to add an else case for your access check if statement that says "available only to VIP players!".

P.S. If you properly format your code, it will make it much easier to read and understand (even for yourself). In fact, by just formatting your code, it showed that you had an extra unneeded brace (or missing a brace depending on if you prefer to add the braces for the else statement, which I always do so that it's less confusing later on):

PHP Code:
if(get_user_flags(id) & ACCESS_FLAG)
{
    if(
g_RoundNum >= 2)
    {
        
drop_weapons(id1);
        
IsUserHaveAwp[id] = true;
        
give_item_ex2(id"weapon_awp"30trueIMPULSE);
    }
    else
    {
        
client_print(idprint_center"available only to VIP players!");
    }

This formatting should make it easier to understand my answer in the first paragraph.
__________________

Last edited by fysiks; 08-31-2020 at 19:19.
fysiks is offline
anakonda001
Member
Join Date: Jul 2020
Old 09-01-2020 , 02:51   Re: add message
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
DJEarthQuake's code is quite wrong but your original code is very close to being correct. Where you currently have "available only to VIP players!" you should put "available from round 2!". Then, you need to add an else case for your access check if statement that says "available only to VIP players!".

PHP Code:
if(get_user_flags(id) & ACCESS_FLAG)
{
    if(
g_RoundNum >= 2)
    {
        
drop_weapons(id1);
        
IsUserHaveAwp[id] = true;
        
give_item_ex2(id"weapon_awp"30trueIMPULSE);
    }
    else
    {
        
client_print(idprint_center"available only to VIP players!");
    }

This formatting should make it easier to understand my answer in the first paragraph.
what the code should look like, please tell me
anakonda001 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 09-01-2020 , 08:58   Re: add message
Reply With Quote #6

Quote:
Originally Posted by anakonda001 View Post
and this is where
client_print(id, print_center, "available from round 2!");
I put it on there now.
__________________

Last edited by DJEarthQuake; 09-01-2020 at 09:00.
DJEarthQuake is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-01-2020 , 23:07   Re: add message
Reply With Quote #7

Quote:
Originally Posted by anakonda001 View Post
what the code should look like, please tell me
I told you exactly what to do:

Quote:
Originally Posted by fysiks View Post
your original code is very close to being correct. Where you currently have "available only to VIP players!" you should put "available from round 2!". Then, you need to add an else case for your access check if statement that says "available only to VIP players!".
It's a real easy change that you can make and you'll be better off by doing it yourself. Try to do it yourself and if you still can't get it working, post your new code and we can help you finish it up.

Quote:
Originally Posted by DJEarthQuake View Post
I put it on there now.
Your code is still overly complicated and confusing (and potential not even correct). Also, if you're going to help people out, you should reformat the code with proper indentation so it's easier to read and understand. You should know better, you've been writing code for a while now.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:37.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode