Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Geldsystem by 8D.
- #include <a_samp>
- new Text:Money[MAX_PLAYERS];
- new Text:Money2[MAX_PLAYERS];
- stock GS_Connect(playerid)
- {
- Money[playerid] = TextDrawCreate(500,80.0,"~n~~n~");
- TextDrawFont(Money[playerid],2);
- TextDrawUseBox(Money[playerid],1);
- TextDrawBoxColor(Money[playerid],0x000000FF);
- TextDrawTextSize(Money[playerid],610.000000,150.000000);
- TextDrawLetterSize(Money[playerid],0.299999,1.000000);
- TextDrawColor(Money[playerid],0xffffffff);
- TextDrawSetProportional(Money[playerid],1);
- Money2[playerid] = TextDrawCreate(515,85.0,"$: 0.00");
- TextDrawLetterSize(Money2[playerid],0.299999,1.000000);
- TextDrawColor(Money2[playerid],0xffffffff);
- TextDrawFont(Money2[playerid],2);
- TextDrawShowForPlayer(playerid,Money[playerid]);
- TextDrawShowForPlayer(playerid,Money2[playerid]);
- SendClientMessage(playerid,COLOR_WHITE,"Dieser Server benutzt das Geldsystem von 8D.");
- }
- stock GS_Disconnect(playerid)
- {
- TextDrawDestroy(Money2[playerid]);
- TextDrawDestroy(Money[playerid]);
- }
- stock GivePlayerCash(playerid,dollars,cents)
- {
- SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")+dollars);
- if(GetPVarInt(playerid,"Cents")+cents > 100)
- {
- SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")+1);
- SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")-100+cents);
- }
- else if(GetPVarInt(playerid,"Cents") + cents < 0)
- {
- SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")-1);
- SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")+100+cents);
- }
- else
- {
- SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")+cents);
- }
- new cashtext[64];
- if(GetPVarInt(playerid,"Cents") == 0)
- {
- format(cashtext,64,"$: %d.%d0",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
- }
- else if(GetPVarInt(playerid,"Cents") > 0 && GetPVarInt(playerid,"Cents") < 10)
- {
- format(cashtext,64,"$: %d.0%d",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
- }
- else
- {
- format(cashtext,64,"$: %d.%d",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
- }
- TextDrawSetString(Money2[playerid],cashtext);
- }
- stock EnoughCash(playerid,dollars,cents)
- {
- if(GetPVarInt(playerid,"Dollars") > dollars) return 1;
- else if((GetPVarInt(playerid,"Dollars") == dollars) && (GetPVarInt(playerid,"Cents") > cents)) return 1;
- else if((GetPVarInt(playerid,"Dollars") == dollars) && (GetPVarInt(playerid,"Cents") == cents)) return 1;
- else return 0;
- }
- stock ResetPlayerCash(playerid)
- {
- SetPVarInt(playerid,"Dollars",0);
- SetPVarInt(playerid,"Cents",0);
- GivePlayerCash(playerid,0,0);
- }
- stock GetPlayerDollars(playerid)
- {
- return GetPVarInt(playerid,"Dollars");
- }
- stock GetPlayerCents(playerid)
- {
- return GetPVarInt(playerid,"Cents");
- }
- stock SetPlayerCash(playerid,dollars,cents)
- {
- SetPVarInt(playerid,"Dollars",0);
- SetPVarInt(playerid,"Cents",0);
- GivePlayerCash(playerid,dollars,cents);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement