Raised This Month: $ Target: $400
 0% 

Point help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shadowdragon
Senior Member
Join Date: Dec 2012
Old 12-21-2013 , 20:06   Point help!
Reply With Quote #1

Hello all i am wanting to know how to make it so if i typed !giveplayercredits STEAMID 100
it would give the player 100 credits i know how to make a command to give it to my self using points[client]+= 100 but i cant figure out how to do it if i wanted to give another player credits

Code:
new points[MAXPLAYERS+1];

Alright guys i tryed this it gives me no errors and compiles when im in game the cmd seems to work but im not getting anycredits any ideas?

Code:
public Action:GiveCredits(client, args)
{
	if (args != 2)
	{
		ReplyToCommand(client, "[SM] Usage: sm_send <steamid> <amount>");
		return Plugin_Handled;	
	}
	
	decl String:steamid[64];
	GetCmdArg(1, steamid, sizeof(steamid));
	
	decl String:samount[64];
	GetCmdArg(2, samount, sizeof(samount));
	new amount = StringToInt(samount);
	
	points[steamid[client]]+=amount;
	
	return Plugin_Handled;
}
__________________
Sorry for my poor English!
________________________________
I can do CSS/CSGO plugin request for little money!

Last edited by shadowdragon; 12-21-2013 at 20:37. Reason: tryed something new
shadowdragon is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 12-22-2013 , 02:11   Re: Point help!
Reply With Quote #2

steamid is the auth string of one client in your case. What do you think "points[steamid[client]]" even suppose to mean?

PHP Code:
new points[MAXPLAYERS+1];

public 
OnPluginStart() {

    
LoadTranslations("common.phrases");
}

public 
Action:GiveCredits(clientargs) {

    if (
args != 2) {
        
ReplyToCommand(client"[SM] Usage: sm_send <steamid> <amount>");
        return 
Plugin_Handled;    
    }
    
    
decl String:steamid[64];
    
GetCmdArg(1steamidsizeof(steamid));
    
    
decl String:samount[64];
    
GetCmdArg(2samountsizeof(samount));
    new 
amount StringToInt(samount);

    new 
target FindTarget(clientsteamid);
    if (
target != -1) {
        
points[target] += amount;
    }
    
    return 
Plugin_Handled;

You can specify steamid by "!giveplayercredits #STEAM_0:0:12345678 100"
Or just by name "!giveplayercredits shadowdragon 100"
xf117 is offline
Send a message via ICQ to xf117
shadowdragon
Senior Member
Join Date: Dec 2012
Old 12-25-2013 , 05:18   Re: Point help!
Reply With Quote #3

ty so much
__________________
Sorry for my poor English!
________________________________
I can do CSS/CSGO plugin request for little money!
shadowdragon 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 05:17.


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