05.01.2014, 14:19
1. Challenge: write a function that prints the nick-name the player with the specified ID account.
On Russian-language forum thread we've come to this conclusion:
But this function displays the nick-name player only when first using it:
https://www.dropbox.com/s/14hisz23cr...2019.20.34.png
https://www.dropbox.com/s/w9uiilr8bm...2019.19.57.png
What's wrong?
2. Challenge: Attach 3D text on vehicle (Incognito Streamer).
The machine ID in the variable is written correctly, but the 3D text en is created. In what could be the problem?
https://www.dropbox.com/s/907axoi9wifhiq3/sa-mp-015.png
Sry for bad English.
On Russian-language forum thread we've come to this conclusion:
PHP код:
stock OfflineName( ID )
{
new query[256], name[24];
format(query, sizeof(query), "SELECT `nick` FROM `players` WHERE `ID` = '%d'", ID);
new Cache:queryname = mysql_query(chandle, query);
if ( cache_num_rows() ) {
cache_get_field_content(0, "nick", name);
}
else {
format (name, 24, "None") ;
}
cache_delete(queryname);
return name;
}
https://www.dropbox.com/s/14hisz23cr...2019.20.34.png
https://www.dropbox.com/s/w9uiilr8bm...2019.19.57.png
PHP код:
if(HouseInfo[id][hOwner] == 0)
{
HouseInfo[id][hPickup] = CreatePickup(1273, 23, HouseInfo[id][hEnterX], HouseInfo[id][hEnterY], HouseInfo[id][hEnterZ], 0);
HouseInfo[id][hMapIcon] = CreateDynamicMapIcon(HouseInfo[id][hEnterX], HouseInfo[id][hEnterY], HouseInfo[id][hEnterZ], 31, 1);
format(string, sizeof(string), "Price: {FFFFFF}$%d", HouseInfo[id][hPrice]);
HouseInfo[id][hLabel] = CreateDynamic3DTextLabel(string, 0xFF7400FF, HouseInfo[id][hEnterX], HouseInfo[id][hEnterY], HouseInfo[id][hEnterZ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 20.0);
}
else
{
HouseInfo[id][hPickup] = CreatePickup(1314, 23, HouseInfo[id][hEnterX], HouseInfo[id][hEnterY], HouseInfo[id][hEnterZ], 0);
format(string, sizeof(string), "Owner: {FFFFFF}%s", OfflineName(HouseInfo[id][hOwner]));
HouseInfo[id][hLabel] = CreateDynamic3DTextLabel(string, 0xFF7400FF, HouseInfo[id][hEnterX], HouseInfo[id][hEnterY], HouseInfo[id][hEnterZ], 20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 20.0);
}
2. Challenge: Attach 3D text on vehicle (Incognito Streamer).
PHP код:
new Float:P[4];
GetPlayerPos(playerid, P[0], P[1], P[2]);
GetPlayerFacingAngle(playerid, P[3]);
CarInfo[LastVehicle][CarServerID] = CreateVehicle(params[2], P[0], P[1], P[2], P[3], random(125), random(125), 360);
format(string, sizeof(string), "Model: {B6FF00}%s\n{FFFFFF}Price: {B6FF00}$%d", GetVehicleName[params[2]-400], params[1]);
CarInfo[LastVehicle][CarLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF, P[0], P[1], P[2], 25.0, INVALID_PLAYER_ID, CarInfo[LastVehicle][CarServerID], 0, -1, -1, -1, 25.0);
https://www.dropbox.com/s/907axoi9wifhiq3/sa-mp-015.png
Sry for bad English.