Post: [C++] RPC call template
12-13-2014, 09:21 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); this method is very clean and u dont need to use pointers like in sebs rpc
    
#include <Windows.h>
#include <iostream>
template<class T,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
int Call(int addr,T p0,T1 p1, T2 p2,T3 p3,T4 p4,T5 p5,T6 p6,T7 p7,T8 pCool Man (aka Tustin)
{
for(int i = 0; i < 9; i++)
{
switch (i)
{
case 0:
if(typeid(T) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 1:
if(typeid(T1) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T1) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T1) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T1) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 2:
if(typeid(T2) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T2) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T2) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T2) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 3:
if(typeid(T3) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T3) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T3) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T3) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 4:
if(typeid(T4) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T4) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T4) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T4) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 5:
if(typeid(T5) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T5) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T5) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T5) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 6:
if(typeid(T6) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T6) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T6) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T6) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 7:
if(typeid(T7) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T7) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T7) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T7) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 8:
if(typeid(TCool Man (aka Tustin) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(float))
{
std::cout<<"float\n";
}
break;
default:
std::cout<<"invalid...\n";
break;
}


}
//get the return value here
system("pause");//just for debug purposes
return 0;
}

how to use:
    
Call<char,int,int,int,int,int,int,int,int>(0x0000,'A',0,0,0,0,0,0,0,0);

or
    
Call(0x0000,"lol",8f,(int)9.3,0,0,0,0,0,0);

have fun Happy
Last edited by milky4444 ; 12-16-2014 at 09:09 PM.

The following 12 users say thank you to milky4444 for this useful post:

One, Boliberrys, Confusing, FusionIsDaName, Kryptus, NickBeHaxing, seb5594, SnaY, Swaqq, SyGnUs, xIce KiLLaH
12-14-2014, 06:53 AM #2
Confusing
Climbing up the ladder
interesting Happy
01-29-2015, 08:00 PM #3
SyGnUs
Give a F*** About Your Lifestyle
Originally posted by milky4444 View Post
this method is very clean and u dont need to use pointers like in sebs rpc
    
#include <Windows.h>
#include <iostream>
template<class T,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
int Call(int addr,T p0,T1 p1, T2 p2,T3 p3,T4 p4,T5 p5,T6 p6,T7 p7,T8 pCool Man (aka Tustin)
{
for(int i = 0; i < 9; i++)
{
switch (i)
{
case 0:
if(typeid(T) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 1:
if(typeid(T1) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T1) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T1) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T1) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 2:
if(typeid(T2) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T2) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T2) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T2) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 3:
if(typeid(T3) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T3) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T3) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T3) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 4:
if(typeid(T4) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T4) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T4) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T4) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 5:
if(typeid(T5) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T5) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T5) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T5) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 6:
if(typeid(T6) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T6) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T6) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T6) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 7:
if(typeid(T7) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(T7) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(T7) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(T7) == typeid(float))
{
std::cout<<"float\n";
}
break;
case 8:
if(typeid(TCool Man (aka Tustin) == typeid(int))
{
std::cout<<"int\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(char))
{
std::cout<<"char\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(char*))
{
std::cout<<"string\n";
}
else if(typeid(TCool Man (aka Tustin) == typeid(float))
{
std::cout<<"float\n";
}
break;
default:
std::cout<<"invalid...\n";
break;
}


}
//get the return value here
system("pause");//just for debug purposes
return 0;
}

how to use:
    
Call<char,int,int,int,int,int,int,int,int>(0x0000,'A',0,0,0,0,0,0,0,0);

or
    
Call(0x0000,"lol",8f,(int)9.3,0,0,0,0,0,0);

have fun Happy


So how would I call something like Cbuf_AddText or SV_GameSendServerCommand with this? I tried but couldn't get it working.
03-18-2016, 08:34 PM #4
I don't see any ccapi / tmapi or PS3 code !
How to make this shit work ?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo