Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @title GVars (Just like PVars)
- @author Carlton
- @copyright 2010
- @description
- Similar like PVars, these are global variables.
- - www.volt-host.com
- - www.epic-missions.com
- */
- //==========================================
- #define MAXIMUM_VARIABLES 1000
- #define MAXIMUM_CHARACTERS 10
- #define CASE_SENSITIVITY true
- //==========================================
- enum GV_D {
- G_Name[MAXIMUM_CHARACTERS],
- G_Int_Value,
- Float:G_Float_Value,
- G_String_Value[256]
- }
- new
- G_VAR_DATA[MAXIMUM_VARIABLES][GV_D],
- G_VAR_ID;
- //==========================================
- stock SetGVarString(varName[], value[]) {
- strmid(G_VAR_DATA[G_VAR_ID][G_Name], varName, 0, strlen(varName), 255);
- strmid(G_VAR_DATA[G_VAR_ID][G_String_Value], value, 0, strlen(value), 255);
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ) {
- if(strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- G_VAR_ID ++;
- break;
- }
- }
- return G_VAR_ID;
- }
- stock GetGVarString(varName[]) {
- new ReturnID[] = "NULL";
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ){
- if(!strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- strmid(ReturnID, G_VAR_DATA[i][G_String_Value], 0, strlen(G_VAR_DATA[i][G_String_Value]), 255);
- break;
- }
- }
- return ReturnID;
- }
- stock SetGVarInt(varName[], value) {
- strmid(G_VAR_DATA[G_VAR_ID][G_Name], varName, 0, strlen(varName), 255);
- G_VAR_DATA[G_VAR_ID][G_Int_Value] = value;
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ) {
- if(strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- G_VAR_ID ++;
- break;
- }
- }
- return G_VAR_ID;
- }
- stock GetGVarInt(varName[]) {
- new ReturnID = -1;
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ){
- if(!strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- ReturnID = G_VAR_DATA[i][G_Int_Value];
- break;
- }
- }
- return ReturnID;
- }
- stock SetGVarFloat(varName[], Float:value) {
- strmid(G_VAR_DATA[G_VAR_ID][G_Name], varName, 0, strlen(varName), 255);
- G_VAR_DATA[G_VAR_ID][G_Float_Value] = value;
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ) {
- if(strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- G_VAR_ID ++;
- break;
- }
- }
- return G_VAR_ID;
- }
- stock Float:GetGVarFloat(varName[]) {
- new Float:ReturnID = -1;
- for(new i = 0; i < MAXIMUM_VARIABLES; i++ ){
- if(!strcmp(G_VAR_DATA[i][G_Name], varName, CASE_SENSITIVITY)) {
- ReturnID = G_VAR_DATA[i][G_Float_Value];
- break;
- }
- }
- return ReturnID;
- }
- stock CountGVars() return G_VAR_ID;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement