Is this possible to convert to r41 code? -
Tenka - 06.08.2018
I try to update SC-RP gamemodes to r41 version
And i got this one i dont know how it work
PHP код:
for (new j = 0; j < 4; j ++)
{
format(str, 24, "rackWeapon%d", j + 1);
RackData[i][rackWeapons][j] = cache_get_field_int(i, str);
format(str, 24, "rackAmmo%d", j + 1);
RackData[i][rackAmmo][j] = cache_get_field_int(i, str);
}
But i try to fix the code below:
PHP код:
for (new j = 0; j < 4; j ++)
{
format(str, 24, "rackWeapon%d", j + 1);
cache_get_value_int(i, str, RackData[i][rackWeapons][j]);
format(str, 24, "rackAmmo%d", j + 1);
cache_get_value_int(i, str, RackData[i][rackAmmo][j]);
}
And i got this one error:
PHP код:
error 035: argument type mismatch (argument 2)
Can anyone explain or help please?
Re: Is this possible to convert to r41 code? -
DBZdabIt3Bro7 - 06.08.2018
cache_get_value_name_int
https://sampwiki.blast.hk/wiki/MySQL#cac...value_name_int
Re: Is this possible to convert to r41 code? -
Banditul18 - 06.08.2018
Quote:
Originally Posted by DBZdabIt3Bro7
|
cache_get_value_* its same thing as cache_get_value_name_*, just macro magic
OT: I doubt you can pass column name like that. Try to write by hand the column names. Also this need a database normalization
Re: Is this possible to convert to r41 code? -
Tenka - 06.08.2018
I have another question how to change this one
PHP код:
if (cache_get_value_int(0, "Admin") > PlayerData[playerid][pAdmin])
return SendErrorMessage(playerid, "You are not authorized to delete a higher admin's character.");
This is ingame command to delete character in database
And the last problem is below:
PHP код:
format(string, sizeof(string), "~b~Creation:~w~ %s", GetDuration(gettime() - cache_get_field_int(0, "CreateDate")));
PlayerTextDrawSetString(extraid, PlayerData[extraid][pTextdraws][76], string);
format(string, sizeof(string), "~b~Played:~w~ %s", GetDuration(gettime() - cache_get_field_int(0, "LastLogin")));
PlayerTextDrawSetString(extraid, PlayerData[extraid][pTextdraws][77], string);
Textdraw to show when people create character and last time played
So sorry for this stupid question but i dont really know how to change it
Re: Is this possible to convert to r41 code? -
Banditul18 - 06.08.2018
Well at first one a soultion will be like this:
PHP код:
new adminLevel;
cache_get_value_int(0, "Admin", adminLevel);
if(adminLeveel > PlayerData[playerid][pAdmin])
return SendErrorMessage(playerid, "You are not authorized to delete a higher admin's character.");
And for second one something similar, as in r40 this functions dont return the value anymore you need to pass the value to a variable
PHP код:
new createDate;
cache_get_value_int(0, "CreateDate", createDate);
format(string, sizeof(string), "~b~Creation:~w~ %s", GetDuration(gettime() - createDate));
PlayerTextDrawSetString(extraid, PlayerData[extraid][pTextdraws][76], string);
Re: Is this possible to convert to r41 code? -
Tenka - 06.08.2018
Thank you guys to help me its all work perfectly