Raised This Month: $32 Target: $400
 8% 

Some simple solutions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CreativeTR
Junior Member
Join Date: Mar 2017
Location: Turkey
Old 03-14-2017 , 16:04   Some simple solutions
#1

They are all described with an example.

Correct Definition

PHP Code:
if(cs_get_user_team(id) == CS_TEAM_T//this may be error
if(cs_get_user_team(id) == CsTeams:CS_TEAM_T//the best way to be sure 
Correct Numerical Data Types

not only
PHP Code:
set_user_gravity(id0.8//this may be error
set_user_gravity(idFloat:0.8//the best way to be sure 
but also
PHP Code:
new p_Gravity[MAX_PLAYERS] = 0.8 //this may be error
new p_Gravity[MAX_PLAYERS] = float:0.8 //the best way to be sure ("float" for defination, "Float" for function - upper case) 
Clean Cvar Usage

PHP Code:
p_Money[id] = get_cvar_num("max_money"//this may be error 
correct way
PHP Code:
#define MAX_PLAYERS 33
new cvar_max_money
new p_Money[MAX_PLAYERS]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
cvar_max_money get_cvar_num("max_money")
}
public 
client_connect(id) {
    
p_Money[id] = cvar_max_money

Clean Algorithm

1:

PHP Code:
new p_Name[33]
get_user_name(idp_Name33
to
PHP Code:
#define MAX_PLAYERS 33
new p_Name[MAX_PLAYERS]
get_user_name(idp_Namecharsmax(p_Name)) 
2:

PHP Code:
set_user_health(idget_user_health(id) + 50)
set_user_armor(idget_user_armor(id) + 50)
p_UsrXP[id] = p_UserXP[id] + 50 
to
PHP Code:
new i_Val 50
set_user_health
(idget_user_health(id) + i_Val)
set_user_armor(idget_user_armor(id) + i_Val)
p_UsrXP[id] += i_Val 
That's just me.

You can add what you know.

Last edited by CreativeTR; 03-14-2017 at 16:08.
CreativeTR is offline
Send a message via Skype™ to CreativeTR
 



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 15:39.


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