16.02.2014, 17:11
(
Последний раз редактировалось anou1; 16.02.2014 в 19:34.
)
Hi,
I did a command to transfer money from your bank account to an other player bank account.
So the CMD is in 2 part. We detect if the receiver of the money is connected, if he is, we don't need sql.
But if he isn't connected, we check if the player exist, if there's isn't account with his name, we return something.
If we found an account, we proceed.
Everytime it return me that the account doesn't exist. And I have this in mysql_log
The CMD doesn't seem to work, I don't know why. Could you please help me ?
PS: I'm not sure if this work:
Should it be "s[24]d" ?
Thank you !
I did a command to transfer money from your bank account to an other player bank account.
Код:
public OnEssaiTransfert(playerid, nom[], somme) { new string[128], query[128]; if(!cache_get_row_count()) return SendClientMessage(playerid, Rouge, "Ce joueur n'existe pas !"); mysql_format(mysql, query, sizeof(query),"UPDATE `joueurs` SET `Banque` = 'Banque + %d' WHERE `Username` = '%e'", somme, nom); pInfo[playerid][Banque] -= somme; format(string, sizeof(string), "Vous avez maintenant %d $ sur votre compte bancaire.", pInfo[playerid][Banque]); SendClientMessage(playerid, Gris,string); GetPlayerName(playerid, joueuremetteur, sizeof(joueuremetteur)); format(string, sizeof(string), "%s a transferer %d $ %s.", joueuremetteur, somme, nom); ChannelAdmin(Rouge, string); return 1; } CMD:transferer(playerid, params[]) // ajouter le IsPlayerInRangeOfPoint de la future banque { new nom, somme, query[128], string[128]; if(sscanf(params, "ud", nom, somme)) return SendClientMessage(playerid, Gris, "Utilisation: /transferer [Nom_Prйnom ou Prйnom_Nom du Joueur] [Somme]"); //Essayer s[24] si ca marche pas if(somme >= 2500000 || somme < 0) return SendClientMessage(playerid, Rouge, "La somme doit кtre comprise entre 1 et 2 500 000 $."); if(pInfo[playerid][Banque] < somme) return SendClientMessage(playerid, Rouge, "Vous n'avez pas assez sur votre compte bancaire."); if(playerid == nom) return SendClientMessage(playerid, Rouge, "Vous ne pouvez pas transferer d'argent а vous mкme."); if(IsPlayerConnected(nom)) { pInfo[playerid][Banque] -= somme; pInfo[nom][Banque] += somme; format(string, sizeof(string), "%s a transferй %d $ sur votre compte bancaire. Vous avez maintenant %d $ sur votre compte.", joueuremetteur, somme, pInfo[nom][Banque]); SendClientMessage(nom, Jaune, string); format(string, sizeof(string), "[Admin]:%s a transferй %d $ sur le compte de %s", joueuremetteur, somme, nom); ChannelAdmin(Rouge, string); return 1; } if(!IsPlayerConnected(nom)) { format(query, sizeof(query), "SELECT * FROM `joueurs` WHERE `Username` = '%s' LIMIT 1", nom); mysql_tquery(mysql, query, "OnEssaiTransfert", "isd", playerid, nom, somme); return 1; } return 1; }
But if he isn't connected, we check if the player exist, if there's isn't account with his name, we return something.
If we found an account, we proceed.
Everytime it return me that the account doesn't exist. And I have this in mysql_log
The CMD doesn't seem to work, I don't know why. Could you please help me ?
PS: I'm not sure if this work:
Код:
if(sscanf(params, "ud", nom, somme)) return SendClientMessage(playerid, Gris, "Utilisation: /transferer [Nom_Prйnom ou Prйnom_Nom du Joueur] [Somme]");
Thank you !