Hello there, I saw a lot of people here in forum asking about a SA-MP Player ID system to be implemented in GTA:N, there is no need for that since you can implement it using C#. This is basicly my first time coding C# Add it your server Settings (settings.xml), example. NOTICE: use playerids always on top or won't work. PHP: <resource src="playerids" /><resource src="welcomemessages" /><resource src="freeroam" /><resource src="admin" /> Exported Methods: PHP: // Returns Client give ID or Part Of Namepublic Client findPlayer(Client sender, string idOrName)// Returns ID given a Clientpublic int getIdFromClient(Client target)// Returns Client given a IDpublic Client getClientFromId(Client sender, int id) Settings from resouce (meta.xml) PHP: <settings> <setting name="max_players" value="50" default="50"/> Set your server max players here. <setting name="player_tags" value="false" default="false"/> If you want to add ID on player head set to true.</settings> How to use findPlayer, example: PHP: [Command("giveweapon", "~y~USAGE: ~w~/giveweapon [id/PartOfName] [weapon]", GreedyArg = true)]public void GiveWeaponCommand(Client sender, string idOrName, WeaponHash weapon){ Client target = API.exported.playerids.findPlayer(sender, idOrName); API.givePlayerWeapon(target, weapon, 9999, true, true);} Another example using getIdFromClient: PHP: public void onPlayerConnect(Client player){ API.sendNotificationToAll("~b~~h~" + player.name + "("+ API.exported.playerids.getIdFromClient(player) + ")~h~ ~w~joined."); API.sendChatMessageToAll("~b~~h~" + player.name + "(" + API.exported.playerids.getIdFromClient(player) + ")~h~ ~w~joined.");} Source Code - LINK Feel free to comment and improve the code if you want to! Greetings, StreetGT
Hello thx for your script, there is just something weird in your code here : https://github.com/tiagocardosoweb/gtanetwork_resources/blob/master/playerids/playerids.cs#L154 The condition is useless here
It doesn't work for me, don't know why it doesn't create the ID above the player and when I try /freeze 0 or /freeze Kruz or /freeze Kruzzel it doesn't work...
Yeah, my playerids.cs was empty. By the way, isn't it possible to not see your own ID above your head?
I have a setting to enable / disable it, I know what he wants. I don't think it's possible to show only labels to other players and don't see your own.
Instead this: PHP: int index = getFreeId();private int getFreeId(){ foreach (var item in players) { if (item == null) { return this.players.IndexOf(item); } } return -1;} You could do: PHP: int index = players.IndexOf(item: null);
Nice work. Everything works correctly when I utilise the command: Code: [Command("giveweapon", "~y~USAGE: ~w~/giveweapon [id/PartOfName] [weapon]", GreedyArg = true)] public void GiveWeaponCommand(Client sender, string idOrName, WeaponHash weapon) { Client target = API.exported.playerids.findPlayer(sender, idOrName); API.givePlayerWeapon(target, weapon, 9999, true, true); } However I get this exception in console: I am unsure as to what this means, should I just ignore it, everything works correctly?
I get this error in the console when running it I have added the xml code to the meta.xml in the playerid resource folder
Code: <?xml version="1.0"?> <config xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <servername>[DEV] - Lee's Cops and Robbers</servername> <serverport>4499</serverport> <maxplayers>50</maxplayers> <minclientversion>0.0.0.0</minclientversion> <minclientversion_auto_update>true</minclientversion_auto_update> <announce>true</announce> <password></password> <masterserver>" rel="nofollow">http://master.gtanet.work/</masterserver> <acl_enabled>true</acl_enabled> <loglevel>0</loglevel> <log>true</log> <global_streaming_range>175</global_streaming_range> <player_streaming_range>500</player_streaming_range> <vehicle_streaming_range>250</vehicle_streaming_range> <vehicle_lagcomp>true</vehicle_lagcomp> <onfoot_lagcomp>true</onfoot_lagcomp> <refresh_rate>120</refresh_rate> <resource src="playerid" /> <resource src="doormanager" /> <resource src="cnr" /> <resource src="daynight" /> <resource src="playerblips2" /> <resource src="admin" /> <resource src="welcomemessages" /> <announce_lan>true</announce_lan> <upnp>false</upnp> <fqdn></fqdn> <conntimeout>false</conntimeout> <allowcefdevtool>false</allowcefdevtool> </config>
It was originally playerids but had to type it in again to show on here and forgot to put the "s" at the end as u can see in the error on cmd it is loading playerids