help with orgname
#1

Код:
CMD:request(playerid, params[])
{
	new id,name[MAX_PLAYER_NAME],tmp[128],string[128];
	if(sscanf(params,"i",id)) return SendClientMessage(playerid, red, "USAGE:/request [org]");
	GetPlayerName(playerid, name, sizeof(name));
	new query[128];
	format(query, sizeof(query), "SELECT * FROM orgs WHERE ID=%d",id);
	mysql_query(query);
 	mysql_store_result();
 	new row[128];
	new field[3][32];
    mysql_fetch_row_format(row, "|");
	explode(row, field, "|");
	tmp[127]=strval(field[1]);
	mysql_free_result();
	new query1[128];
	format(query1,sizeof(query1), "UPDATE ostats SET req=%d WHERE Name='%s'",id,name);
	mysql_query(query1);
	format(string, sizeof(string), "~%s is requesting to join %s.",name,tmp[127]);
	SendClientMessageToAll(COLOR_ORANGE, string);
	return 1;
}
it doesnt show the org name which is stored in the variable "tmp".
Reply
#2

tmp[127] is the last cell of the array, since you save the number from field[1] in it I would say that you should use %d to print it
Reply
#3

but im storing a name in tmp so isnt it supposed to be %s?
Reply
#4

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
but im storing a name in tmp so isnt it supposed to be %s?
where are you storing a name in tmp ? show me the line
Reply
#5

tmp=strval(field[1])

there is a name in field 1
Reply
#6

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
tmp=strval(field[1])

there is a name in field 1
But you used strval (converts a string to an integer) :/

like you said the name is in field 1 so use field[1] in the format and remove tmp
Reply
#7

can you edit the code for me? i didnt get you =P
Reply
#8

Try it with that

pawn Код:
CMD:request(playerid, params[])
{
    if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, red, "USAGE:/request [org]");
    new name[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(string, sizeof string, "UPDATE ostats SET req=%d WHERE Name='%s'", params[0], name);
    mysql_query(string);
    format(string, sizeof string, "SELECT * FROM orgs WHERE ID=%d", params[0]);
    mysql_query(string);
    mysql_store_result();
    mysql_fetch_row_format(string, "|");
    mysql_free_result();
    params[0] = (strfind(string, "|", false) + 1);
    string[strfind(string, "|", false, params[0])] = EOS;
    format(string, sizeof string, "~%s is requesting to join %s.", name, string[params[0]]);
    SendClientMessageToAll(COLOR_ORANGE, string);
    return 1;
}
Reply
#9

Sorry for going offtopic, but i mis-read the name of the thread. Instead of 'orgname' i read 'orgasm'. That makes me lol'd for an hour
Reply
#10

Quote:
Originally Posted by -Danny-
Посмотреть сообщение
Sorry for going offtopic, but i mis-read the name of the thread. Instead of 'orgname' i read 'orgasm'. That makes me lol'd for an hour
It is not an off topic section. So don't give stupid replies
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)