SA-MP Forums Archive
Is this possible to convert to r41 code? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is this possible to convert to r41 code? (/showthread.php?tid=657379)



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 04++)
        {
            
format(str24"rackWeapon%d"1);
            
RackData[i][rackWeapons][j] = cache_get_field_int(istr);
            
format(str24"rackAmmo%d"1);
            
RackData[i][rackAmmo][j] = cache_get_field_int(istr);
        } 
But i try to fix the code below:

PHP код:
        for (new 04++)
        {
            
format(str24"rackWeapon%d"1);
            
cache_get_value_int(istrRackData[i][rackWeapons][j]);
            
format(str24"rackAmmo%d"1);
            
cache_get_value_int(istrRackData[i][rackAmmo][j]);
        } 
And i got this one error:

PHP код:
error 035argument 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(stringsizeof(string), "~b~Creation:~w~ %s"GetDuration(gettime() - cache_get_field_int(0"CreateDate")));
                
PlayerTextDrawSetString(extraidPlayerData[extraid][pTextdraws][76], string);
                
format(stringsizeof(string), "~b~Played:~w~ %s"GetDuration(gettime() - cache_get_field_int(0"LastLogin")));
                
PlayerTextDrawSetString(extraidPlayerData[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(stringsizeof(string), "~b~Creation:~w~ %s"GetDuration(gettime() - createDate)); 
                
PlayerTextDrawSetString(extraidPlayerData[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