CMD:givedp(playerid, params[]) {
new player[MAX_PLAYER_NAME], quantidade, string[128];
if(sscanf(params,"si", player, quantidade)) return SendClientMessage(playerid, -1, "Use: /givedp [player-name] [ammount]");
new idplayer;
idplayer = GetPlayerIdFromName(player);
if(idplayer >= 0) {
idplayer = GetPlayerIdFromName(player);
DP[idplayer] += quantidade;
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (ONLINE)", PlayerName(playerid), quantidade, PlayerName(idplayer) );
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(idplayer, COLOR_LIGHTBLUE, string);
}
else {
new rows, fields;
cache_get_data(rows, fields);
if (!rows) return SendClientMessage(playerid, -1, "Nгo hб nenhum player com esse nome.");
new query[200], dpatual;
format(query, sizeof(query), "SELECT * FROM accounts WHERE Username='%s'", player);
mysql_query(ConnectMYSQL,query);
mysql_store_result(); // error 017: undefined symbol "mysql_store_result"
while(mysql_fetch_row_format(query,"|")) // error 017: undefined symbol "mysql_fetch_row_format"
{
dpatual = cache_get_field_content_int(0, "DP");
}
mysql_free_result(); // error 017: undefined symbol "mysql_store_result"
format(query, sizeof(query), "UPDATE accounts SET DP=%d WHERE Username='%s'",
dpatual + quantidade,
player);
mysql_query(ConnectMYSQL,query);
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (OFFLINE)", PlayerName(playerid), quantidade, player );
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(idplayer, COLOR_LIGHTBLUE, string);
}
return 1;
}
mysql_store_result(); // error 017: undefined symbol "mysql_store_result"
while(mysql_fetch_row_format(query,"|")) // error 017: undefined symbol "mysql_fetch_row_format"
{
dpatual = cache_get_field_content_int(0, "DP");
}
mysql_free_result(); // error 017: undefined symbol "mysql_store_result"
CMD:givedp(playerid, params[])
{
new Nameid[25], valor,string[128],query[160],idplayer;
if(sscanf(params,"s[25]i", Nameid, valor))
return SendClientMessage(playerid, -1, "Use: /givedp [player-name] [ammount]");
idplayer = GetPlayerIdFromName(Nameid);
if(IsPlayerConnected(idplayer))
{
DP[idplayer] += valor;
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (ONLINE)", PlayerName(playerid), valor, PlayerName(idplayer));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(idplayer, COLOR_LIGHTBLUE, string);
}else{
mysql_format(ConnectMYSQL, query, sizeof query, "SELECT `Username`, `DP` FROM accounts WHERE Username = '%e' LIMIT 1", Nameid);
mysql_tquery(ConnectMYSQL, query, "AddDP", "isi", playerid, Nameid, valor);
}
return true;
}
forward AddDP(playerid, Nameid[], valor);
public AddDP(playerid, Nameid[], valor)
{
new query[200], string[128];
if(cache_get_row_count(ConnectMYSQL) == 1)
{
dpatual = cache_get_field_content_int(0, "DP");
mysql_format(ConnectMYSQL, query, sizeof query, "UPDATE accounts SET DP = '%d' WHERE Username = '%s'", dpatual+valor, Nameid);
mysql_tquery(ConnectMYSQL, query, "", "");
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (OFFLINE)", PlayerName(playerid), valor, Nameid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
SendClientMessage(playerid, -1, "Nгo hб nenhum player com esse nome.");
return true;
}
|
Olб warriorfrog, aqui estб o comando funcional:
Код:
CMD:givedp(playerid, params[])
{
new Nameid[25], valor,string[128],query[160],idplayer;
if(sscanf(params,"s[25]i", Nameid, valor))
return SendClientMessage(playerid, -1, "Use: /givedp [player-name] [ammount]");
idplayer = GetPlayerIdFromName(Nameid);
if(IsPlayerConnected(idplayer))
{
DP[idplayer] += valor;
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (ONLINE)", PlayerName(playerid), valor, PlayerName(idplayer));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(idplayer, COLOR_LIGHTBLUE, string);
}else{
mysql_format(ConnectMYSQL, query, sizeof query, "SELECT `Username`, `DP` FROM accounts WHERE Username = '%e' LIMIT 1", Nameid);
mysql_tquery(ConnectMYSQL, query, "AddDP", "isi", playerid, Nameid, valor);
}
return true;
}
forward AddDP(playerid, Nameid[], valor);
public AddDP(playerid, Nameid[], valor)
{
new query[200], string[128];
if(cache_get_row_count(ConnectMYSQL) == 1)
{
dpatual = cache_get_field_content_int(0, "DP");
mysql_format(ConnectMYSQL, query, sizeof query, "UPDATE accounts SET DP = '%d' WHERE Username = '%s'", dpatual+valor, Nameid);
mysql_tquery(ConnectMYSQL, query, "", "");
format(string, sizeof(string), "O admin %s adicionou %i DONATE POINTS para %s (OFFLINE)", PlayerName(playerid), valor, Nameid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
SendClientMessage(playerid, -1, "Nгo hб nenhum player com esse nome.");
return true;
}
|