Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- #include <dudb>
- new IsLogged[MAX_PLAYERS], file[128];
- enum pInfo
- {
- AdminLevel,
- SkinID,
- PlayerLevel,
- Cash,
- Banned,
- Sindacco,
- Tier,
- Faction,
- Rank [256],
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //==========================================//Moving the stored data in "Rank" into the
- //==========================================//variable "pprank" and assigning it with the playerid.
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, aname, sizeof(aname));
- format(stri, sizeof(stri), "%s.ini", aname);
- if(fexist(stri))
- {
- new pprank[256];
- pprank = dini_Get(stri, "Rank");
- PlayerInfo [playerid] [Rank] = strval(pprank);
- }
- return 1;
- }
- // On OnPlayerDisconnect it is reset. ( The rank )
- //===============// The faction chat /f ( The problem is that it does not show the rank )
- if (strcmp(cmd, "/f", true) == 0)
- {
- GetPlayerName(playerid, name, sizeof(name));
- format(file, sizeof(file), "%s.ini", name);
- if(fexist(file))
- {
- new temp[256], temp2[256], temp3[256];
- temp = dini_Get(file, "Faction");
- temp2 = dini_Get(file, "Sindacco");
- temp3 = dini_Get(file, "Rank");
- if(strval(temp) > 0 && strval(temp2) > 0)
- {
- if(strlen(pID) == 0) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /f [Message].");
- kreplace(name, '_', ' ');
- format(s, sizeof(s), "(( %s %s says: %s ))",strval(PlayerInfo [playerid] [Rank]) ,name, cmdtext[3]);
- for( q = 0; q <= MAX_PLAYERS; q++)
- {
- GetPlayerName(q, pname, sizeof(pname));
- format(strin, sizeof(strin), "%s.ini", pname);
- if(fexist(strin))
- {
- new atemp[256], atemp2[256];
- atemp = dini_Get(strin, "Faction");
- atemp2 = dini_Get(file, "Sindacco");
- if(strval(atemp) > 0 && strval(atemp2) > 0)
- {
- SendClientMessage(q, COLOR_BRIGHT_YELLOW, s);
- }
- }
- }
- }
- else SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to perform this command.");
- }
- return 1;
- }
- //=======================================// Setting the player's rank and storing it inside the
- //=======================================// "Rank" inside the player's file.
- if(strcmp(cmd, "/setrank", true) == 0)
- {
- new tmp[256], tmp1[256], tmp2[256], tmp4[256], fRank[256];
- fRank = strtok1(cmdtext, idx);
- GetPlayerName(playerid, pname, sizeof(pname));
- format(strin, sizeof(strin), "%s.ini", pname);
- if(fexist(strin))
- {
- tmp1 = dini_Get(strin, "Faction");
- tmp2 = dini_Get(strin, "Tier");
- tmp4 = dini_Get(strin, "Sindacco");
- if(strval(tmp1) == 1 && strval(tmp2) == 0)
- {
- GetPlayerName(strval(pID), name, sizeof(name));
- format(file, sizeof(file), "%s.ini", name);
- if(!IsPlayerConnected(strval(pID))) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Wrong player name or player ID.");
- if(fexist(file))
- {
- if(strlen(pID) == 0) return SendClientMessage(playerid, COLOR_USAGE, "USAGE: /setrank [PlayerID] [Rank].");
- tmp = dini_Get(file, "Faction");
- if(strval(tmp) == 1)
- {
- new tmp3[256];
- tmp3 = dini_Get(file, "Sindacco");
- if( strval(tmp3) == strval(tmp4) )
- {
- dini_Set(file, "Rank", fRank);
- PlayerInfo [strval(pID)] [Rank] = strval(fRank);
- GetPlayerName(strval(pID), aname, sizeof(aname));
- kreplace(aname, '_', ' ');
- format(str, sizeof(str), "(Sindacco): %s's rank has been changed to %s", aname, cmdtext[10+strlen(pID)]);
- SendClientMessage(strval(pID), COLOR_FMESSAGES, str);
- }
- }
- else SendClientMessage(playerid, COLOR_ERROR, "ERROR: Selected player is not in any faction.");
- }
- else SendClientMessage(playerid, COLOR_ERROR, "ERROR: Wrong player name or player ID.");
- }
- else SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to use this command.");
- }
- return 1;
- }
- //====================================// What may be wrong? When I go to the player's file, it
- //====================================// shows only the first four letters of the rank, why?
- //====================================// May I not store and load words using dini?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement