Jump to content
  • 0

pomoc GetPlayerID


Fisher

Dotaz

4 odpovědí na tuto otázku

Recommended Posts

  • 0

No myslím to, že mi vůbec nefunguje funkce GetPlayerId, mělo by to být GetPlayerId("nějaký string"), nevíte co s tím , vyhodí mi to vždy error, že tuto funkci nezná :(

 

Děkuju :) 

Link to comment
Share on other sites

  • 0
  • Hlavní moderátor

Nauc sa popisovat problém.. Nerozumiem ti ani slovo....

 

zajímavé, já mu rozumím

 

GetPlayerID("test") ? o.O má to byť GetPlayerID(playerid);

 

jistě, získej hráčovo ID z hráčova ID (facepalm)

 

zkus tohle, dělal jsem to já (nemusí to být dokonalé, funkční by to ale být mělo):

num(const string[]) //by ???
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}

GetPlayerID(const str[])
{
	if(!strlen(str)) return INVALID_PLAYER_ID;
	if(num(str))
	{
		if(IsPlayerConnected(strval(str))) return strval(str);
		return INVALID_PLAYER_ID;
	}
	new name[MAX_PLAYER_NAME+1];
	for(new i;i<MAX_PLAYERS;i++)
	{
	        if(!IsPlayerConnected(i)) continue;
   		GetPlayerName(i,name,sizeof(name));
    	        if(strfind(name,str,true) != -1) return i;
	}
	return INVALID_PLAYER_ID;
}

používej nějak takto:

new id;

id = GetPlayerID("nick");

if(!IsPlayerConnected(id)) //kontrola, zda není online
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...