input string to a dialog - 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: input string to a dialog (
/showthread.php?tid=613368)
how to input string to dialog then going to mysql? -
kampuman - 27.07.2016
I need help. I'm trying to make my own Rename House script because the fs that I have downloaded doesn't have. So I'm not sure what exactly to do and how to make it right.
Edit: The dialogs is now showing but after after entering the value it didn't change the value. What could be the problem?
PHP код:
new housenumber = GetHouseID( playerid );
new MAX_HOUSE_NAME [20];
if ( strcmp( GetGVarStringEx( "h_Owner", housenumber ), PlayerName( playerid ), false ) )
return SendClientMessage( playerid, -1,""SV_RD"» {c8c8c8}This house isn't yours!" );
if ( strlen( MAX_HOUSE_NAME ) < 1 || strlen( MAX_HOUSE_NAME ) > 20 ) return ShowPlayerDialog(playerid, DIALOG_HOUSE_NAME, DIALOG_STYLE_INPUT, "Rename House", "Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.", "Change", "Back");
format( gsQuery, sizeof gsQuery, "UPDATE `houses` SET `HName` = '%s' WHERE `HouseID` = '%d'", MAX_HOUSE_NAME,housenumber );
mysql_query( gsQuery, THREAD_NONE, playerid );
format( gsString, sizeof( gsString ), ""W"Press "ORANGE_"H "W"key to Enter the House\n"SV_BL"House Name: "W"%s\n"SV_BL"House Owner: "W"%s\n "SV_BL"House Value: "W"%d$\n "SV_BL"House Privacy: "RED_"Closed\n"SV_BL"House ID: "ORANGE_"%d",GetGVarStringEx( "h_name", housenumber ), PlayerName(playerid), GetGVarInt( "h_Cost", housenumber),housenumber);
UpdateDynamic3DTextLabelText( Text3D:GetGVarInt( "House3DText", housenumber ), 0xFF9900FF, gsString );
Re: input string to a dialog -
BoBiTza - 27.07.2016
try to filter that code and make them a recovery and arranges to understand something else does not readable
Re: input string to a dialog -
ThatFag - 27.07.2016
Код:
new housenumber = GetHouseID( playerid );
new MAX_HOUSE_NAME [20] = strlen(inputtext) ;
if ( strcmp( GetGVarStringEx( "h_Owner", housenumber ), PlayerName( playerid ), false ) )
return SendClientMessage( playerid, -1,""SV_RD"» {c8c8c8}This house isn't yours!" );
if ( strlen( MAX_HOUSE_NAME ) < 1 || strlen( MAX_HOUSE_NAME ) > 20 ) return ShowPlayerDialog(playerid, DIALOG_HOUSE_NAME, DIALOG_STYLE_INPUT, "Rename House", "Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.", "Change", "Back");
format( gsQuery, sizeof gsQuery, "UPDATE `houses` SET `HName` = '%s' WHERE `HouseID` = '%d'", MAX_HOUSE_NAME,housenumber );
mysql_query( gsQuery, THREAD_NONE, playerid );
format( gsString, sizeof( gsString ), ""W"Press "ORANGE_"H "W"key to Enter the House\n"SV_BL"House Name: "W"%s\n"SV_BL"House Owner: "W"%s\n "SV_BL"House Value: "W"%d$\n "SV_BL"House Privacy: "RED_"Closed\n"SV_BL"House ID: "ORANGE_"%d",GetGVarStringEx( "h_name", housenumber ), PlayerName(playerid), GetGVarInt( "h_Cost", housenumber),housenumber);
UpdateDynamic3DTextLabelText( Text3D:GetGVarInt( "House3DText", housenumber ), 0xFF9900FF, gsString );
Test and tell if it works or not