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;
}
VehicleNames[GetVehicleModel(GetPlayerVehicleID(targetid))-400]);
Are you talking about the "SERVER: unknown command" error?
If so, the code probably crashes somewhere.... Try downloading "crashdetect" plugin to confirm this issue. I believe this may be the reason: pawn Код:
|
if(IsPlayerInAnyVehicle(targetid))
format(str3, sizeof (str3), "~y~In A ~w~%s.", VehicleNames[GetVehicleModel(GetPlayerVehicleID(targetid))-400]);
else strcat(str3,"~y~not in vehicle"); // no need to use format if there are no variables.