25.11.2009, 07:45
i think the stock script returns 1 all the time, but:
format(string, sizeof(string), "Name Is: %d", i);
SendClientMessageToAll(COLOR_YELLOW,string);
shows the correct name/id.
and when i enable the sendclientmessage on this:
if (closestplayer(playerid) && cuffed[giveplayerid] == 0) {
format(string, sizeof(string), "/cuff %d", closestplayer(playerid));
playercommandtext(playerid, string);
SendClientMessageToAll(COLOR_YELLOW, string);
}
the Wrong id whows up on the SendClientMessage on this script :S
Thanks in advance. cdcyborg.
format(string, sizeof(string), "Name Is: %d", i);
SendClientMessageToAll(COLOR_YELLOW,string);
shows the correct name/id.
and when i enable the sendclientmessage on this:
if (closestplayer(playerid) && cuffed[giveplayerid] == 0) {
format(string, sizeof(string), "/cuff %d", closestplayer(playerid));
playercommandtext(playerid, string);
SendClientMessageToAll(COLOR_YELLOW, string);
}
the Wrong id whows up on the SendClientMessage on this script :S
Код:
stock closestplayer(playerid) { for(new i=0; i<MAX_PLAYERS; i++) { if(GetDistanceBetweenPlayers(playerid, i) < 6 && i != playerid && IsPlayerConnected(i) && !IsPlayerNPC(i)) { //Distance of 5 in-game meters //new oname[MAX_PLAYER_NAME]; new string[256]; //GetPlayerName(i, oname, sizeof(oname)); format(string, sizeof(string), "Name Is: %d", i); SendClientMessageToAll(COLOR_YELLOW,string); return format(string, sizeof(string), "%d", i); } } return 0; } new giveplayerid = closestplayer(playerid); if(gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY && GetDistanceBetweenPlayers(playerid, giveplayerid) < 7) { if (closestplayer(playerid) == playerid) return 0; if (closestplayer(playerid) && cuffed[giveplayerid] == 0) { format(string, sizeof(string), "/cuff %d", closestplayer(playerid)); playercommandtext(playerid, string); //SendClientMessageToAll(COLOR_YELLOW, string); } else if (closestplayer(playerid) && cuffed[giveplayerid] == 1 && GetPlayerWantedLevel(giveplayerid) >= 1 ) { if (GetPlayerWantedLevel(giveplayerid) < 4) { format(string, sizeof(string), "/fine %d", closestplayer(playerid)); playercommandtext(playerid, string); //SendClientMessageToAll(COLOR_YELLOW, string); } else if (GetPlayerWantedLevel(giveplayerid) >= 4) { format(string, sizeof(string), "/ar %d", closestplayer(playerid)); playercommandtext(playerid, string); //SendClientMessageToAll(COLOR_YELLOW, string); } } else if (GetPlayerWantedLevel(giveplayerid) < 1 && justsearched[giveplayerid] == 0 && cuffed[giveplayerid] == 1) { format(string, sizeof(string), "/search %d", closestplayer(playerid)); playercommandtext(playerid, string); //SendClientMessageToAll(COLOR_YELLOW, string); justsearched[giveplayerid] = 1; } else { format(string, sizeof(string), "/uc %d", closestplayer(playerid)); justsearched[giveplayerid] = 0; playercommandtext(playerid, string); //SendClientMessageToAll(COLOR_YELLOW, string); } }