GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Paradize le 24 Décembre 2009, 06:40:13
-
Euh.......... ::)
J'ai un petit soucis...où que j'aille, je peux retirer de l'argent...
Sa me met :
"Vous n'êtes pas à la banque"
"Vous avez retiré 10$ de votre compte bancaire"
(http://img7.hostingpics.net/pics/30237sa_mp_006.png)
Et je peux retirer partout..
Est-ce que sa vient de mes positions des distributeur ? Les voici :
public IsAtATM(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(4.0,playerid,2054.6145,-1898.2306,13.5538) || PlayerToPoint(4.0,playerid,2061.0833,-1898.6965,13.5538))
{
return 1;
}
else if(PlayerToPoint(4.0,playerid,1843.9344,-1861.1429,13.3828) || PlayerToPoint(10.0,playerid,1739.2867,-1862.8655,13.5758))
{
return 1;
}
}
return 0;
}
-
public IsAtATM(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(4.0,playerid,2054.6145,-1898.2306,13.5538) || PlayerToPoint(4.0,playerid,2061.0833,-1898.6965,13.5538)||PlayerToPoint(4.0,playerid,1843.9344,-1861.1429,13.3828) || PlayerToPoint(10.0,playerid,1739.2867,-1862.8655,13.5758))
{
return 1;
}
else
{
return 0;
}
}
}
-
D:\_FR__G~1\GAMEMO~1\Paradize.pwn(1967) : warning 209: function "IsAtATM" should return a value
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Header size: 6096 bytes
Code size: 1108820 bytes
Data size: 4472896 bytes
Stack/heap size: 16384 bytes; estimated max. usage=5103 cells (20412 bytes)
Total requirements: 5604196 bytes
1 Warning.
:-[
-
public IsAtATM(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(4.0,playerid,2054.6145,-1898.2306,13.5538) || PlayerToPoint(4.0,playerid,2061.0833,-1898.6965,13.5538)||PlayerToPoint(4.0,playerid,1843.9344,-1861.1429,13.3828) || PlayerToPoint(10.0,playerid,1739.2867,-1862.8655,13.5758))
{
return 1;
}
else
{
return 0;
}
}
return 1;
}
-
Sa marche toujours pas
Je peux retirer de l'argent mais sa m'affiche toujours çà :
"Vous n'êtes pas à la banque"
"Vous avez retiré 10$ de votre compte bancaire"
Je vous montre mon /retirer :
//----------------------------------[Banque Système]-----------------------------------------------
if(strcmp(cmd, "/retirer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (!PlayerToPoint(100, playerid,2308.9287,-13.2520,26.7422))
{
SendClientMessage(playerid, COLOR_GREY, " Tu n'es pas à la banque !");
}
else if(!IsAtATM(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW," Vous n'êtes prés d'un distributeur !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retirer [montant]");
format(string, sizeof(string), " Vous avez $%d sur votre compte.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retirer [montant]");
format(string, sizeof(string), " Vous avez $%d sur votre compte.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'avez pas tant d'argent !");
return 1;
}
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,cashdeposit);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
format(string, sizeof(string), " Vous avez retirer $%d de votre compte, Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
return 1;
}
Position distributeurs :
public IsAtATM(playerid)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(4.0,playerid,2054.6145,-1898.2306,13.5538) || PlayerToPoint(4.0,playerid,2061.0833,-1898.6965,13.5538)||PlayerToPoint(4.0,playerid,1843.9344,-1861.1429,13.3828) || PlayerToPoint(10.0,playerid,1739.2867,-1862.8655,13.5758))
{
return 1;
}
else
{
return 0;
}
}
return 1;
}
-
Voila, avec le code que je t'ai envoyer par MSN, normalemetn sa devrait aller, il te suffit de changer les coordonner des coordonné de tes ATM, et normalement tout iras bien ;)
-
ca :
if (!PlayerToPoint(100, playerid,2308.9287,-13.2520,26.7422))
{
SendClientMessage(playerid, COLOR_GREY, " Tu n'es pas à la banque !");
}
remplace par ca:
if (!PlayerToPoint(100, playerid,2308.9287,-13.2520,26.7422))
{
return SendClientMessage(playerid, COLOR_GREY, " Tu n'es pas à la banque !");
}
-
D'accord, je testerais ce que vous me dites après..car j'ai essayé avec une autre méthode :
//-------------------------------[Distributeurs]------------------------------------
if(strcmp(cmd, "/retireratm", true) == 0 || strcmp(cmd, "/ratm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(3, playerid, 2054.6145,-1898.2306,13.5538) && !PlayerToPoint(3, playerid, 2061.0833,-1898.6965,13.5538))
{
SendClientMessage(playerid, COLOR_GREY, "Vous n'êtes pas au Mistercash!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retireratm [montant]");
format(string, sizeof(string), "Vous avez $%d sur votre compte bancaire.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retireratm [montant]");
format(string, sizeof(string), " Vous avez $%d sur votre compte bancaire.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Vous n'avez pas cette somme sur votre compte bancaire!");
return 1;
}
if (cashdeposit > 5000)
{
SendClientMessage(playerid, COLOR_GRAD2, "Vous ne pouvez pas retirer plus de $5000!");
return 1;
}
ConsumingMoney[playerid] = 1;
SafeGivePlayerMoney(playerid,-cashdeposit);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
format(string, sizeof(string), "Vous avez retiré $%d de votre compte, Il vous reste: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
//PlayerInfo[playerid][pJobTimer] = 12;
GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " ID(%d) -%s a retiré %d de son compte bancaire.", playerid,giveplayer,cashdeposit);
ABroadCast(COLOR_YELLOW,string,1);
PayLog(string);
return 1;
}
return 1;
}
if(strcmp(cmd, "/deposeratm", true) == 0 || strcmp(cmd, "/datm", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(3, playerid, -32.276363,-57.995586,1003.139953) && !PlayerToPoint(3, playerid, 374.718902,167.128982,1007.987304))
{
SendClientMessage(playerid, COLOR_GREY, "Vous n'êtes pas au Mistercash!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /deposeratm [montant]");
format(string, sizeof(string), "Vous avez $%d sur votre compte bancaire.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /deposeratm [montant]");
format(string, sizeof(string), "Vous avez $%d sur votre compte bancaire.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > GetPlayerMoney(playerid) || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Vous n'avez pas cette somme sur vous");
return 1;
}
if (cashdeposit > 100000)
{
SendClientMessage(playerid, COLOR_GRAD2, "Vous ne pouvez pas deposer plus de $100000!");
return 1;
}
SafeGivePlayerMoney(playerid,-cashdeposit);
new curfunds = PlayerInfo[playerid][pAccount];
PlayerInfo[playerid][pAccount]=cashdeposit+PlayerInfo[playerid][pAccount];
SendClientMessage(playerid, COLOR_WHITE, "|___________ Extrait de Compte ___________|");
format(string, sizeof(string), " Argent sur le compte avant depôt: $%d", curfunds);
SendClientMessage(playerid, COLOR_GRAD2, string);
format(string, sizeof(string), " Somme déposée: $%d",cashdeposit);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_GRAD6, "|------------------------------------------|");
format(string, sizeof(string), " Argent sur le compte après dépôt: $%d", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_WHITE, string);
//PlayerInfo[playerid][pJobTimer] = 12;
GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), " ID(%d) -%s à déposé %d sur son compte bancaire.", playerid,giveplayer,cashdeposit);
ABroadCast(COLOR_YELLOW,string,1);
PayLog(string);
return 1;
}
return 1;
}
Mais j'ai deux erreurs à la compilation :
D:\_FR__G~1\GAMEMO~1\Paradize.pwn(8145) : error 017: undefined symbol "SafeGivePlayerMoney"
D:\_FR__G~1\GAMEMO~1\Paradize.pwn(8197) : error 017: undefined symbol "SafeGivePlayerMoney"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
:-[
-
Il s'agit du
GivePlayerMoney de l'anti cheat de Seif ( SA-MP Forum )
Remplace
SeifGivePlayerMoney
par
GivePlayerMoney
-
Niquel merci :), plus qu'à régler le PlayerToPoint et sa sera parfait..
Par contre, vous pensez que c'est mieux d'opter pour le /retirer ou d'opter pour /retireratm ?
A vos avis... :-[
-
Bah le plus logique serait de mettre /retirer.
-
J'essaye avec le /retirer mais j'ai deux erreurs :-[ :
//----------------------------------[Banque Système]-----------------------------------------------
if(strcmp(cmd, "/retirer", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (!PlayerToPoint(100, playerid,2308.9287,-13.2520,26.7422))
{
return SendClientMessage(playerid, COLOR_GREY, " Tu n'es pas à la banque !");
}
else if(!IsAtATM(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW," Vous n'êtes prés d'un distributeur !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retirer [montant]");
format(string, sizeof(string), " Vous avez $%d sur votre compte.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /retirer [montant]");
format(string, sizeof(string), " Vous avez $%d sur votre compte.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Vous n'avez pas tant d'argent !");
return 1;
}
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,cashdeposit);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-cashdeposit;
format(string, sizeof(string), " Vous avez retirer $%d de votre compte, Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
return 1;
}
-
C'est quoi les erreurs ?
-
Merde, j'ai oublié les erreurs ;D; désolé :
D:\_FR__G~1\GAMEMO~1\Paradize.pwn(10406) : warning 217: loose indentation
D:\_FR__G~1\GAMEMO~1\Paradize.pwn(10414) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Header size: 6096 bytes
Code size: 1108676 bytes
Data size: 4472896 bytes
Stack/heap size: 16384 bytes; estimated max. usage=5103 cells (20412 bytes)
Total requirements: 5604052 bytes
2 Warnings.
-
Ah sa se ne sont pas des erreurs mais warning. La sa te prévient juste qu'une partie de ton code est mal indenter (ou mal aligner ) mais sa ne change rien une fois le serveur lancer.
-
Pas besoin de les corriger ? Enfin du moins pas besoin le temps que je test le fonctionnement des distributeurs ?