30.07.2016, 09:29
Hello!
I'm trying to call faction name from the table 'faction'.
it's called 'factionname'. So I'm trying to assign factionname to Faction[playerid][factionname].
However it doesn't seem to work.
I'm trying to call faction name from the table 'faction'.
it's called 'factionname'. So I'm trying to assign factionname to Faction[playerid][factionname].
However it doesn't seem to work.
PHP Code:
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP код:</div>
<div class="alt2" dir="ltr" style="
margin: 0px;
padding: 6px;
border: 1px solid #C2C2C2;
width: 800px;
height: 178px;
text-align: left;
overflow: auto">
<code style="white-space:nowrap">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB">forward callBackFunction</span><span style="color: #007700">(</span><span style="color: #0000BB">playerid</span><span style="color: #007700">);
<br/>public </span><span style="color: #0000BB">callBackFunction</span><span style="color: #007700">(</span><span style="color: #0000BB">playerid</span><span style="color: #007700">)
<br/>{
<br/>
<br/> </span><span style="color: #0000BB">Faction</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">ID</span><span style="color: #007700">] = </span><span style="color: #0000BB">cache_insert_id</span><span style="color: #007700">();
<br/> </span><span style="color: #0000BB">cache_get_field_content</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #DD0000">"factionname"</span><span style="color: #007700">,</span><span style="color: #0000BB">Faction</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">FactionName</span><span style="color: #007700">]);
<br/> </span><span style="color: #0000BB">ShowPlayerDialog</span><span style="color: #007700">(</span><span style="color: #0000BB">playerid</span><span style="color: #007700">, </span><span style="color: #0000BB">factiontyped</span><span style="color: #007700">, </span><span style="color: #0000BB">DIALOG_STYLE_LIST</span><span style="color: #007700">, </span><span style="color: #DD0000">"FACTION CREATION"</span><span style="color: #007700">, </span><span style="color: #DD0000">"Type 0(Drugs)\nType 1(Weapons)"</span><span style="color: #007700">, </span><span style="color: #DD0000">"Choose"</span><span style="color: #007700">,</span><span style="color: #DD0000">"Cancel"</span><span style="color: #007700">);
<br/> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"[INFO] New faction created. Database ID: [%d]"</span><span style="color: #007700">, </span><span style="color: #0000BB">Faction</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">ID</span><span style="color: #007700">]);
<br/>}
<br/></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</code>
</div>
</div>I'm trying to access Faction[playerid][Factionname] to a individual player like this.
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP код:</div>
<div class="alt2" dir="ltr" style="
margin: 0px;
padding: 6px;
border: 1px solid #C2C2C2;
width: 800px;
height: 50px;
text-align: left;
overflow: auto">
<code style="white-space:nowrap">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">[</span><span style="color: #0000BB">PHP</span><span style="color: #007700">]</span><span style="color: #0000BB">mysql_format</span><span style="color: #007700">(</span><span style="color: #0000BB">mysql</span><span style="color: #007700">,</span><span style="color: #0000BB">query</span><span style="color: #007700">,</span><span style="color: #0000BB">sizeof</span><span style="color: #007700">(</span><span style="color: #0000BB">query</span><span style="color: #007700">), </span><span style="color: #DD0000">"UPDATE `accounts` SET `factionname` = %e `factionid` = %d WHERE ID = %d LIMIT 1"</span><span style="color: #007700">, </span><span style="color: #0000BB">Faction</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">FactionName</span><span style="color: #007700">], </span><span style="color: #0000BB">Faction</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">ID</span><span style="color: #007700">], </span><span style="color: #0000BB">Player</span><span style="color: #007700">[</span><span style="color: #0000BB">playerid</span><span style="color: #007700">][</span><span style="color: #0000BB">ID</span><span style="color: #007700">]);
<br/> </span><span style="color: #0000BB">mysql_tquery</span><span style="color: #007700">(</span><span style="color: #0000BB">mysql</span><span style="color: #007700">,</span><span style="color: #0000BB">query</span><span style="color: #007700">,</span><span style="color: #DD0000">""</span><span style="color: #007700">,</span><span style="color: #DD0000">""</span><span style="color: #007700">);
<br/></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</code>
</div>
</div>