09.09.2014, 11:01
Hi. I need help with fixing this command.
Includes this requires:
a_samp
dcmd
playerzone
What the command does in my script is it returns an invalid command message upon entering a valid player id, but when I give an invalid player id, it returns the: * Player Is Not Connected. message. Please help me and thanks!
Includes this requires:
a_samp
dcmd
playerzone
pawn Код:
dcmd_locate(playerid, params[])
{
new targetid;
if(LoginCheck[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "* You Must Be Logged To Use Any Command!");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /locate [Player Name/ID]");
if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid )) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
{
new str1[128], str2[128], str3[128], str4[128], str5[128], str6[128];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(targetid,targetname,24);
format(str1, sizeof (str1), "~y~Location For:~w~ %s (%d)", targetname, targetid);
format(str2, sizeof (str2), "~y~Location:~w~ %s.", GetPlayerZone(targetid));
format(str3, sizeof (str3), "~y~In A ~w~%s.", VehicleNames[GetVehicleModel(GetPlayerVehicleID(targetid))-400]);
format(str4, sizeof (str4), "~y~On Foot.");
format(str5, sizeof (str5), "~y~Dead.");
format(str6, sizeof (str6), "~y~San Andreas");
TextDrawSetString(locationtext, str1);
TextDrawSetString(locationtextR1, str2);
new playerState = GetPlayerState(targetid);
if(IsPlayerInAnyVehicle(targetid))
{
TextDrawSetString(locationtextR2, str3);
}
if(playerState == PLAYER_STATE_ONFOOT)
{
TextDrawSetString(locationtextR2, str4);
}
if(playerState == PLAYER_STATE_WASTED)
{
TextDrawSetString(locationtextR2, str5);
}
if(aduty[targetid] == 1)
{
TextDrawSetString(locationtextR2, str4);
TextDrawSetString(locationtextR1, str6);
}
if(spectate[targetid] == 1)
{
TextDrawSetString(locationtextR2, str4);
TextDrawSetString(locationtextR1, str6);
}
TextDrawHideForPlayer(playerid,locationtextR1);
TextDrawHideForPlayer(playerid,locationtextR2);
TextDrawHideForPlayer(playerid,locationtext);
TextDrawHideForPlayer(playerid,locationtext2);
TextDrawShowForPlayer(playerid,locationtext);
TextDrawShowForPlayer(playerid,locationtext2);
TextDrawShowForPlayer(playerid,locationtextR1);
TextDrawShowForPlayer(playerid,locationtextR2);
}
return 1;
}