AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   String formatted incorrectly (https://forums.alliedmods.net/showthread.php?t=214304)

At3u 04-25-2013 10:04

String formatted incorrectly
 
Edit: Done

YamiKaitou 04-25-2013 10:08

Re: String formatted incorrectly
 
You are not formatting your strings correctly. You have a %s in them but don't pass any value to it

At3u 04-25-2013 10:11

Re: String formatted incorrectly
 
Done. Thx

YamiKaitou 04-25-2013 10:24

Re: String formatted incorrectly
 
Enable debug and it will tell you exactly where the error is

At3u 04-25-2013 10:37

Re: String formatted incorrectly
 
Whit debug enabled:


String formatted incorrectly - parameter 4 (total 3)
[AMXX] Displaying debug trace (plugin "CooL_Live.amxx")
AMXX] Run time error 25: parameter error
[AMXX] [0] colorchat.inc::ColorChat (line 37)
[AMXX] [1] 5j3vx4pm.sma.p::mesaj1 (line 64)
String formatted incorrectly - parameter 4 (total 3)
[AMXX] Displaying debug trace (plugin "CooL_Live.amxx")
[AMXX] Run time error 25: parameter error
AMXX] [0] colorchat.inc::ColorChat (line 37)
[AMXX] [1] 5j3vx4pm.sma.p::mesaj2 (line 69)
String formatted incorrectly - parameter 4 (total 3)
[AMXX] Displaying debug trace (plugin "CooL_Live.amxx")
[AMXX] Run time error 25: parameter error
[AMXX] [0] colorchat.inc::ColorChat (line 37)
[AMXX] [1] 5j3vx4pm.sma.p::mesaj4 (line 84)

Backstabnoob 04-25-2013 10:38

Re: String formatted incorrectly
 
Code:
public mesaj1(id) {     client_cmd(0,"spk ^"life in three seconds^"");     ColorChat(id, GREEN, "[^x03 %s^x04 ]^x01 |---------------^x04 LiVE !^x01 ---------------|"); } public mesaj2(id) {     ColorChat(id, GREEN, "[^x03 %s^x04 ]^x01 |---------------^x04 LiVE !^x01 ---------------|"); } public mesaj3(id) {     ColorChat(id, GREEN, "[^x03 %s^x04 ]^x01 |---------------^x04 LiVE !^x01 ---------------|"); }

You need to add an extra argument to the function, which is the string %s will be replaced by.

At3u 04-25-2013 17:40

Re: String formatted incorrectly
 
Solved

Blizzard_87 04-25-2013 21:33

Re: String formatted incorrectly
 
change this
Code:
public say_live(id) {     server_cmd("sv_restart 3")     set_task(0.1,"mesaj1",id)     set_task(0.2,"mesaj2",id)     set_task(0.3,"mesaj4",id)     return PLUGIN_CONTINUE; }

to this

Code:
public say_live(id, lvl, cid) {     if(!cmd_access(id, lvl, cid, 2)         return PLUGIN_HANDLED;         server_cmd("sv_restart 3")     set_task(0.1,"mesaj1",id)     set_task(0.2,"mesaj2",id)     set_task(0.3,"mesaj4",id)     return PLUGIN_CONTINUE; }

At3u 04-26-2013 04:30

Re: String formatted incorrectly
 
Edit: Solved


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

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