Jump to content
  • 0

Cerere Ajutor Save Coins


xt3z0ne

Question

Nick:Johnny

Problema:Pai problema este ca nu imi salveaza coins am incorporat sistem-u in luxadmin dar dupa ce ies nu mai ramane coins salvat

Erori / warnings:~

Lini/script:

Syste-mu de coins este asta

[pawn]

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

PLEASE DON'T REMOVE!!!!!CREDITS!!!!!!!! xxSPEEDYxx's Coins system|

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

||=========================================================================================||

||                                                                                        ||

||>>  / /      ||=========  ||=========  ||=========    ||====\\      \\      //      <<||

||>>  / /      ||    ||    ||            ||            ||      \\    \\    //      <<||

||>>  \ \      ||    ||    ||            ||            ||        \\    \\  //        <<||

||>>    \ \    ||    ||    ||======      ||======      ||        //    \\//        <<||

||>>      \ \  ||======      ||            ||            ||      //      //          <<||

||>>      / /  ||            ||            ||            ||    //        //            <<||

||>>    / /    ||            ||=========  ||=========    ||====+        //            <<||

||                                                                                        ||

||=========================================================================================||

*/

#include <a_samp>

#include <Dini>

#include <sscanf2>

#define PlayerFile                  "Coins System/%s.ini"

#define coinsD 187

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define Red 0xFF0000FF

#define Grey 0xAFAFAFAA

#define Green 0x33AA33AA

#define Yellow 0xFFFF00AA

#define White 0xFFFFFFAA

#define Blue 0x0000BBAA

#define Lightblue 0x33CCFFAA

#define Orange 0xFF9900AA

#define Lime 0x10F441AA

#define Magenta 0xFF00FFFFT

#define Navy 0x000080AA

#define Aqua 0xF0F8FFAA

#define Crimson 0xDC143CAA

#define Black 0x000000AA

#define Brown 0XA52A2AAA

#define Gold 0xB8860BAA

#define Limegreen 0x32CD32AA

enum PLAYER_MAIN

{

  Coins

}

new giveplayercoinsid, amount;

new pInfo[MAX_PLAYERS][PLAYER_MAIN];

public OnPlayerConnect(playerid)

{

new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);

if(!dini_Exists(file)) {

    dini_Create(file);

dini_IntSet(file,"Coins", pInfo[playerid][Coins]);

}

pInfo[playerid][Coins] = dini_Int(file,"Coins");

return 1;

}

public OnPlayerDisconnect(playerid, reason)

{

new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);

dini_IntSet(file,"Coins", pInfo[playerid][Coins]);

return 1;

}

public OnPlayerCommandText(playerid, cmdtext[])

{

    dcmd(givecoins, 9, cmdtext);

    dcmd(setcoins, 8, cmdtext);

    return 0;

}

dcmd_givecoins(playerid, params[])

{

if(sscanf(params, "ud", giveplayercoinsid, amount)) SendClientMessage(playerid, Orange, "USAGE : /givecoins [playerid] [amount]");

else if(giveplayercoinsid == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "ERROR : That player is not connected!");

else if(giveplayercoinsid == playerid) SendClientMessage(playerid, Red, "ERROR : You cant send yourself coins!");

else if(amount > pInfo[playerid][Coins]) SendClientMessage(playerid, Red, "ERROR : You dont have that amount of coins!");

else

{

new string[156],file[100],Name[MAX_PLAYER_NAME],Ip[16],name[MAX_PLAYER_NAME]; GetPlayerName(giveplayercoinsid, name, sizeof(name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);

format(string, sizeof(string), "SERVER : You have succesfully sent %d coins to %s!", amount, name);

SendClientMessage(playerid, Limegreen, string);

format(string, sizeof(string), "SERVER : %s has given to you %d coins!", Name, amount);

SendClientMessage(giveplayercoinsid, Limegreen, string);

pInfo[giveplayercoinsid][Coins] += amount;

pInfo[playerid][Coins] -= amount;

dini_IntSet(file,"Coins", pInfo[giveplayercoinsid][Coins]);

dini_IntSet(file,"Coins", pInfo[playerid][Coins]);

}

return 1;

}

dcmd_setcoins(playerid, params[])

{

if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, Red, "ERROR : Only admins can use that command!");

if(sscanf(params, "ud", giveplayercoinsid, amount)) SendClientMessage(playerid, Orange, "USAGE : /setcoins [playerid] [amount]");

else if(giveplayercoinsid == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "ERROR : That player is not connected!");

else

{

new string[156],file[100],Name[MAX_PLAYER_NAME],Ip[16],name[MAX_PLAYER_NAME]; GetPlayerName(giveplayercoinsid, name, sizeof(name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);

format(string, sizeof(string), "You have succesfully setted %s coins to %d!", name, amount);

SendClientMessage(playerid, Limegreen, string);

format(string, sizeof(string), "Admin %s has setted your coins to %d!", Name, amount);

SendClientMessage(giveplayercoinsid, Limegreen, string);

pInfo[giveplayercoinsid][Coins] = amount;

dini_IntSet(file,"Coins", pInfo[giveplayercoinsid][Coins]);

}

return 1;

}

[/pawn]

Iar eu am facut asa

#define PlayerFile                  "LuxAdmin/Coins/%s.ini"

Am incercat si cu Coins System dar nimic.

Va rog se poate sa ma ajute careva :-?

Ai incercat sa rezolvi singur ?:~~ Da am incercat si nam reusit.

EDIT: cand dau /setcoins imi urca coins in /stats dar dupa iesire nu mai am nmk..:((

Sunt un retardat

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

T/C. 2 days+ without reply.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.