Everything is Ok in Command!. but Player State Bugs!
There is a bug that when i do /i [myid] i can see my state that im in vehicle or im onfoot!
but other player is in vehicle or onfoot and when i use /i(nfo) [playerid] there player state bug's and its only showing onfoot.
PHP код:
dcmd_info(playerid, params[])
{
new string[256], giveplayerid;
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /info [Playerid]");
new Levelstr[256], Locstr[256], vstr[256];
if (PlayerInfo[giveplayerid][pTeam] == TEAM_LAW || PlayerInfo[giveplayerid][pVigilante] == 1)
{
format(Levelstr, sizeof(Levelstr), "~b~Level %d Rank: %s",PlayerInfo[giveplayerid][pLevel],PoliceRanks[PlayerInfo[giveplayerid][pRank]]);
}
else
{
switch (PlayerInfo[giveplayerid][pWantedLevel])
{
case 0:format(Levelstr, sizeof(Levelstr), "~w~Wanted Level %d Innocent Civilian",PlayerInfo[giveplayerid][pWantedLevel]);
case 1..5:format(Levelstr, sizeof(Levelstr), "~y~Wanted Level %d",PlayerInfo[giveplayerid][pWantedLevel]);
case 6..9:format(Levelstr, sizeof(Levelstr), "~r~Wanted Level %d",PlayerInfo[giveplayerid][pWantedLevel]);
case 10:format(Levelstr, sizeof(Levelstr), "~r~Wanted Level %d Most Wanted",PlayerInfo[giveplayerid][pWantedLevel]);
}
}
if (PlayerInfo[giveplayerid][pSpawn] == 0)
{
Locstr = "~r~Dead in Whole Somewhere";
}
else if(PlayerInfo[giveplayerid][pSpecID] > -1)
{
Locstr = "~p~San Andreas";
}
else
{
format(Locstr, sizeof(Locstr), "~p~%s",PlayerInfo[giveplayerid][pLocation]);
}
if(IsPlayerInVehicle(giveplayerid,vehicleid))
{
format(vstr, sizeof(vstr), "~p~In %s",aVehicleNames[modelid - 400]);
}
else
{
vstr = "~p~On Foot";
}
if(PlayerInfo[giveplayerid][pTeam] == TEAM_LAW)
{
HideAllServerTextDraws(playerid);
StopKeyState(playerid);
format(string, sizeof(string), "~g~Player Info~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_");
TextDrawSetString(InfoTD0, string);
format(string, sizeof(string), "Name: ~b~%s (%d)~n~~w~Skill: ~p~%s~n~~n~%s~n~~w~Location: ~n~%s~n~~b~%s~n~%s",
PlayerInfo[giveplayerid][pName],
giveplayerid,
SkillNames[PlayerInfo[giveplayerid][pSkill]],
Levelstr,
Locstr,
DistanceFromPlayerToPlayer(playerid, giveplayerid),
vstr);
TextDrawSetString(InfoTD1, string);
format(string, sizeof(string), "Press~y~ LMB~w~ To Close The Box");
TextDrawSetString(InfoTD2, string);
TextDrawShowForPlayer(playerid, InfoTD0);
TextDrawShowForPlayer(playerid, InfoTD1);
TextDrawShowForPlayer(playerid, InfoTD2);
info1[playerid]=1;
}
else
{
HideAllServerTextDraws(playerid);
StopKeyState(playerid);
format(string, sizeof(string), "~g~Player Info~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_~n~_");
TextDrawSetString(InfoTD0, string);
format(string, sizeof(string), "Name: ~p~%s (%d)~n~~w~Skill:~p~ %s~n~~n~%s~n~~w~Location: ~n~%s~n~~b~%s~n~%s",
PlayerInfo[giveplayerid][pName],
giveplayerid,
SkillNames[PlayerInfo[giveplayerid][pSkill]],
Levelstr,
Locstr,
DistanceFromPlayerToPlayer(playerid, giveplayerid),
vstr);
TextDrawSetString(InfoTD1, string);
format(string, sizeof(string), "Press~y~ LMB~w~ To Close The Box");
TextDrawSetString(InfoTD2, string);
TextDrawShowForPlayer(playerid, InfoTD0);
TextDrawShowForPlayer(playerid, InfoTD1);
TextDrawShowForPlayer(playerid, InfoTD2);
info1[playerid]=1;
}
return 1;
}
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /info [Playerid]");
...
if(IsPlayerInVehicle(giveplayerid,vehicleid))
{
format(vstr, sizeof(vstr), "~p~In %s",aVehicleNames[modelid - 400]);
}
else
{
vstr = "~p~On Foot";
}
It gets the vehicleid and modelid of the player who typed the command and then it checks if the given player is in the vehicle of the player who typed the command and if not, it says on foot. So remove the 2 lines above sscanf and change to: