Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdkhooks>
- #include <sdktools>
- char sDataFilePath[PLATFORM_MAX_PATH];
- public OnPluginStart()
- {
- BuildPath(Path_SM, sDataFilePath, sizeof(sDataFilePath), "data/prefix.ini");
- if (!FileExists(sDataFilePath))
- {
- new Handle:open_path = OpenFile(sDataFilePath, "w");
- WriteFileLine(open_path, "");
- CloseHandle(open_path);
- PrintToServer("Error Code: WSP-EC-01A");
- }
- }
- public OnClientPutInServer(i)
- {
- if(IsValidClient(i))
- {
- KeyValues kv = new KeyValues("prefix");
- if (kv.ImportFromFile(sDataFilePath))
- {
- decl String:name[32];
- GetClientName(i, name, sizeof(name))
- if (KvJumpToKey(kv, name, false))
- {
- char szBuffer[32];
- KvGetString(kv, "prefix", szBuffer, sizeof(szBuffer));
- Format(name, sizeof(name), "[%s]%N", szBuffer, name)
- SetClientInfo(i, "name", name);
- kv.ExportToFile(sDataFilePath);
- }
- else
- {
- KvJumpToKey(kv, name, true);
- {
- kv.SetString("prefix", "[Noob]");
- SetClientInfo(i, "name", name);
- kv.ExportToFile(sDataFilePath);
- }
- }
- }
- }
- }
- stock bool:IsValidClient( client )
- {
- if ( client < 1 || client > MaxClients ) return false;
- if ( !IsClientConnected( client )) return false;
- if ( !IsClientInGame( client )) return false;
- if ( GetClientTeam( client ) != 2 ) return false;
- if ( !IsPlayerAlive( client )) return false;
- return true;
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment