problem with saying gang name
#1

Ok guys, I made a gang everything works, but I can't really tell him the gang name with a cmd like /gang (you will see at the end of the thread), the text is empty even tho the gang name should be stored into player's enum.

PHP код:
enum ENUM_PLAYER_DATA
{
    
GangID,
    
GangIDD,
    
NameGang,
    
OwnerGang,
};
new 
pInfo[MAX_PLAYERS][ENUM_PLAYER_DATA]; 
/creategang

PHP код:
CMD:creategang(playeridparams[])
{
    new 
gName[100], string[150], query[250];
    if(
pInfo[playerid][GangID] == 1) return SendClientMessage(playeridCOLOR_YELLOW"(gang) You can't make a gang since you already are in a gang");
    if(
sscanf(params"s[100]"gName)) return SendClientMessage(playeridCOLOR_YELLOW"(gang) Syntax: /creategang (gang name)");
    if(
CheckGangByName(gName)) return SendClientMessage(playeridCOLOR_YELLOW"(gang) A gang with this name is already taken");
    
    
     
mysql_format(g_SQLquerysizeof query"INSERT INTO `gangs` (GangID, GangName, GangOwner) VALUES (NULL, '%s', '%s')"gNamePlayerName[playerid]);
     
mysql_tquery(g_SQLquery);
     
     
     
format(stringsizeof(string), "You created: '%s'"gName);
     
SendClientMessage(playerid, -1string);
    
pInfo[playerid][GangID] = 1;
    
      
mysql_format(g_SQLquerysizeof query"UPDATE `players` SET `idgang` = '1' WHERE `id` = '%d'"pInfo[playerid][ID]);
      
mysql_tquery(g_SQLquery);
    
    return 
1;

Assigning player data
PHP код:
    cache_get_value_int(0"idgang"pInfo[playerid][GangID]);
    
cache_get_value_int(0"GangID"pInfo[playerid][GangIDD]);
    
cache_get_value_int(0"GangName"pInfo[playerid][NameGang]);
    
cache_get_value_int(0"GangOwner"pInfo[playerid][OwnerGang]); 
Creating MySQL tables (I deleted 300 other tables and put only 'idgang' table only to be easy to understand and look wheres the problem. Don't worry if the string is 1500.)

PHP код:
    new query[1500] = "`idgang` mediumint(8) NOT NULL DEFAULT '0')");
    
mysql_tquery(g_SQL"CREATE TABLE IF NOT EXISTS `gangs` (`GangID` INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY, `GangName` VARCHAR(100) NOT NULL, `GangOwner` VARCHAR(25) NOT NULL)"); 
After the player made his own gang name, I need to retrieve it into a text, like Your Gang: %s

PHP код:
CMD:gang(playerid){
    new 
str[160];
    if(
pInfo[playerid][GangID] == 1)
    {
    
format(strsizeof(str), "Gang: %s"pInfo[playerid][NameGang]);
    
SendClientMessage(playerid, -1str);
    }else{
    
SendClientMessage(playerid, -1"you don't have any gang");
    }
    return 
1;

And this is what it looks like:

Gang:

Just empty.
Reply


Messages In This Thread
problem with saying gang name - by severance - 22.08.2018, 09:22
Re: problem with saying gang name - by severance - 22.08.2018, 09:46
Re: problem with saying gang name - by Rufio - 22.08.2018, 09:57
Re: problem with saying gang name - by severance - 22.08.2018, 10:17
Re: problem with saying gang name - by Rufio - 22.08.2018, 10:19
Re: problem with saying gang name - by severance - 22.08.2018, 10:55
Re: problem with saying gang name - by Rufio - 22.08.2018, 11:11
Re: problem with saying gang name - by severance - 23.08.2018, 11:15
Re: problem with saying gang name - by JasonRiggs - 23.08.2018, 11:27
Re: problem with saying gang name - by severance - 23.08.2018, 11:46

Forum Jump:


Users browsing this thread: 3 Guest(s)