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

!beaconpls


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 04-16-2011 , 14:51   !beaconpls
Reply With Quote #1

Well, it's my first plugin, I would like to make a purchasing system beacon, where the player uses the !Beaconpls to buy a beacon for short time, but I am not knowing later add a function to give the player beacon.

PHP Code:
#include <sourcemod>
 
public Plugin:myinfo =
{
    
name "CZS beaconpls",
    
author "Rodrigo286, thanks to Mewtwo",
    
description "Command to buy a beacon.",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"
};
 
public 
OnPluginStart()

)    

public 
BuyBeacon(client){
    new 
money;
    new 
cost;
    if (
g_iMoney == -1) return;
    if (
hasPara[client] == false){
        
money GetEntData(client,g_iMoney);
        
cost GetConVarInt(g_cost);
        if (
cost == 0){
            
PrintMsg(client,"Already have a beacon");
        }
        else{
            if((
money cost)<0){
                
PrintMsg(client,"No Money");
            }
            else{
                
hasPara[client] = true;
                
SetEntData(client,g_iMoney,money-cost);
                
PrintMsg(client,"Have Bought a beacon");
            }
        }
    }
    else{
        
PrintMsg(client,"Have beacon");
    }
    
}

public 
Action:HandleSay(clientargs){
    new 
String:line[30];
    if(
GetConVarInt(g_enabled) == 0) return Plugin_Continue;
    if (
args 0){
        
GetCmdArg(1,line,sizeof(line));
        if (
strcmp(g_game,"cstrike",false)==0){
            if (
StrEqual(line"!beaconpls"false) || StrEqual(line"!buy_beacon"false)) BuyBeacon(client);
        }
        else{
            
SetConVarInt(g_cost,0);
            if (
StrEqual(line"!beaconpls"false) || StrEqual(line"!buy_beacon"false)) PrintMsg(client,"Already have a beacon");
        }
    }
    return 
Plugin_Continue;

Regards.
rodrigo286 is offline
 



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


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