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

[CS:GO] ckSurf (1.18f, 24.11.2015)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 04-26-2017 , 15:08   Re: [CS:GO] ckSurf (1.18f, 24.11.2015)
Reply With Quote #11

Quote:
Originally Posted by TrappaTroopa View Post
So using SourceMod Store (Not Zeph's Store) is there a way to give credits on map completions? There is one here: https://forums.alliedmods.net/showthread.php?p=1883627

But that is for TIMER (CS:S). Not ckSurf
try this, not tested
PHP Code:
// Includes
#include <sourcemod>
#include <store/store-core>
#include <cksurf>

// Compiler Options
#pragma semicolon 1
#pragma newdecls required

ConVar gc_iCreditsNormal;
ConVar gc_iCreditsBonus;
ConVar gc_iCreditsPrac;

// Info
public Plugin myinfo 
{
    
name "[CKsurf] Store Credits Giver",
    
author "shanapu",
    
description "Give Credits for SM Store on finished map",
    
version "1.1",
    
url "https://github.com/shanapu/"
};

public 
void OnPluginStart()
{
    
gc_iCreditsNormal CreateConVar("sm_cksurfcredits_normal""50""How many credits for finishing map?"_true1.0);
    
gc_iCreditsBonus CreateConVar("sm_cksurfcredits_bonus""100""How many credits for finishing bonus?"_true1.0);
    
gc_iCreditsPrac CreateConVar("sm_cksurfcredits_practise""25""How many credits for finishing practise?"_true1.0);
}

public 
Action ckSurf_OnMapFinished(int clientfloat fRunTimechar sRunTime[54], int rankint total)
{
    if(!
IsValidClient(client))
    {
        return;
    }

    
int accountId Store_GetClientAccountID(client);
    
int oldCredits Store_GetCreditsEx(accountId);
    
    
Store_GiveCredits(accountId, (oldCredits+gc_iCreditsNormal.IntValue));

    
PrintToChat(client"\x04[Store]\x01 You have successfully earned %d cash for finishing this map."gc_iCreditsNormal.IntValue);
}

public 
Action ckSurf_OnBonusFinished(int clientfloat fRunTimechar sRunTime[54], int rankint totalint bonusid)
{    
    if(!
IsValidClient(client))
    {
        return;
    }

    
int accountId Store_GetClientAccountID(client);
    
int oldCredits Store_GetCreditsEx(accountId);
    
    
Store_GiveCredits(accountId, (oldCredits+gc_iCreditsBonus.IntValue));

    
PrintToChat(client"\x04[Store]\x01 You have successfully earned %d cash for finishing this map."gc_iCreditsBonus.IntValue);
}

public 
Action ckSurf_OnPracticeFinished(int clientfloat fRunTimechar sRunTime[54])
{
    if(!
IsValidClient(client))
    {
        return;
    }

    
int accountId Store_GetClientAccountID(client);
    
int oldCredits Store_GetCreditsEx(accountId);
    
    
Store_GiveCredits(accountId, (oldCredits+gc_iCreditsPrac.IntValue));

    
PrintToChat(client"\x04[Store]\x01 You have successfully earned %d cash for finishing this map."gc_iCreditsPrac.IntValue);
}

bool IsValidClient(int clientbool bAlive false)
{
    if(
client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (bAlive == false || IsPlayerAlive(client)))
    {
        return 
true;
    }
    
    return 
false;

Quote:
Originally Posted by sneaK View Post
Search, somewhere in this thread or elsewhere there is a plugin. Pretty sure yash made it.
yashs is made for zephs
Attached Files
File Type: sp Get Plugin or Get Source (ckcredits.sp - 112 views - 2.5 KB)
File Type: smx ckcredits.smx (6.0 KB, 126 views)
__________________
coding & free software

Last edited by shanapu; 04-26-2017 at 15:32. Reason: added bonus & practise
shanapu is offline
 


Thread Tools
Display Modes

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 19:52.


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