AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Truncate value from vault (https://forums.alliedmods.net/showthread.php?t=217778)

alonelive 06-07-2013 11:48

Truncate value from vault
 
Hello!

we have this:

server_print("%d. %-20.20s %d", (i + 1), data[VD_Key], data[VD_Value]);
How i can truncate for printing value in data[VD_Key]: 'TIMEPLAYED' ?

What i have:

3. TIMEPLAYED[P*D]Dredd 8

What i want:

3. [P*D]Dredd 8

PHP Code:

    new name[33];
    new 
vaultkey[64], vaultdata[64];
    
    
get_user_name(idname32);
    
    
format(vaultkey63"TIMEPLAYED%s"name); 
    
format(vaultdata63"%d"PlayedTime); 


Kia 06-07-2013 12:20

Re: Truncate value from vault
 
TIMEPLAYED%s -> %s TIMEPLAYED

alonelive 06-07-2013 12:29

Re: Truncate value from vault
 
Quote:

Originally Posted by Kia (Post 1966229)
TIMEPLAYED%s -> %s TIMEPLAYED

no..
i want to remove the word 'TIMEPLAYED' from output of server_print
but this keyword will still in DB (do not edit).

Bugsy 06-07-2013 12:38

Re: Truncate value from vault
 
Will the value always be? "TIMEPLAYED$name$"?

If so, just reference the string with strVariable[ 10 ]

Or change it when saved? Based on your last post it sounds like you do not want to change the way its saved?

PHP Code:

format(vaultkey63"TIMEPLAYED%s"name);  

to 

formatex
(vaultkey63"%s"name); 


alonelive 06-07-2013 12:44

Re: Truncate value from vault
 
Thank you!, solved..

Kia 06-07-2013 13:21

Re: Truncate value from vault
 
Quote:

Originally Posted by alonelive (Post 1966241)
no..
i want to remove the word 'TIMEPLAYED' from output of server_print
but this keyword will still in DB (do not edit).

Oh sorry, misunderstood that.


All times are GMT -4. The time now is 16:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.