Advertisement
Guest User

8D's Geldsystem.inc

a guest
Jun 12th, 2010
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.93 KB | None | 0 0
  1. // Geldsystem by 8D.
  2.  
  3.  
  4. #include <a_samp>
  5.  
  6. new Text:Money[MAX_PLAYERS];
  7. new Text:Money2[MAX_PLAYERS];
  8.  
  9.  
  10. stock GS_Connect(playerid)
  11. {
  12.     Money[playerid] = TextDrawCreate(500,80.0,"~n~~n~");
  13.     TextDrawFont(Money[playerid],2);
  14.     TextDrawUseBox(Money[playerid],1);
  15.     TextDrawBoxColor(Money[playerid],0x000000FF);
  16.     TextDrawTextSize(Money[playerid],610.000000,150.000000);
  17.     TextDrawLetterSize(Money[playerid],0.299999,1.000000);
  18.     TextDrawColor(Money[playerid],0xffffffff);
  19.     TextDrawSetProportional(Money[playerid],1);
  20.  
  21.     Money2[playerid] = TextDrawCreate(515,85.0,"$: 0.00");
  22.     TextDrawLetterSize(Money2[playerid],0.299999,1.000000);
  23.     TextDrawColor(Money2[playerid],0xffffffff);
  24.     TextDrawFont(Money2[playerid],2);
  25.    
  26.     TextDrawShowForPlayer(playerid,Money[playerid]);
  27.     TextDrawShowForPlayer(playerid,Money2[playerid]);
  28.     SendClientMessage(playerid,COLOR_WHITE,"Dieser Server benutzt das Geldsystem von 8D.");
  29. }
  30.  
  31. stock GS_Disconnect(playerid)
  32. {
  33.     TextDrawDestroy(Money2[playerid]);
  34.     TextDrawDestroy(Money[playerid]);
  35. }
  36.  
  37. stock GivePlayerCash(playerid,dollars,cents)
  38. {
  39.     SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")+dollars);
  40.     if(GetPVarInt(playerid,"Cents")+cents > 100)
  41.     {
  42.         SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")+1);
  43.         SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")-100+cents);
  44.     }
  45.     else if(GetPVarInt(playerid,"Cents") + cents < 0)
  46.     {
  47.         SetPVarInt(playerid,"Dollars",GetPVarInt(playerid,"Dollars")-1);
  48.         SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")+100+cents);
  49.     }
  50.     else
  51.     {
  52.         SetPVarInt(playerid,"Cents",GetPVarInt(playerid,"Cents")+cents);
  53.     }
  54.     new cashtext[64];
  55.     if(GetPVarInt(playerid,"Cents") == 0)
  56.     {
  57.         format(cashtext,64,"$: %d.%d0",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
  58.     }
  59.     else if(GetPVarInt(playerid,"Cents") > 0 && GetPVarInt(playerid,"Cents") < 10)
  60.     {
  61.         format(cashtext,64,"$: %d.0%d",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
  62.     }
  63.     else
  64.     {
  65.         format(cashtext,64,"$: %d.%d",GetPVarInt(playerid,"Dollars"),GetPVarInt(playerid,"Cents"));
  66.     }
  67.     TextDrawSetString(Money2[playerid],cashtext);
  68. }
  69.  
  70. stock EnoughCash(playerid,dollars,cents)
  71. {
  72.     if(GetPVarInt(playerid,"Dollars") > dollars) return 1;
  73.     else if((GetPVarInt(playerid,"Dollars") == dollars) && (GetPVarInt(playerid,"Cents") > cents)) return 1;
  74.     else if((GetPVarInt(playerid,"Dollars") == dollars) && (GetPVarInt(playerid,"Cents") == cents)) return 1;
  75.     else return 0;
  76. }
  77.  
  78. stock ResetPlayerCash(playerid)
  79. {
  80.     SetPVarInt(playerid,"Dollars",0);
  81.     SetPVarInt(playerid,"Cents",0);
  82.     GivePlayerCash(playerid,0,0);
  83. }
  84.  
  85. stock GetPlayerDollars(playerid)
  86. {
  87.     return GetPVarInt(playerid,"Dollars");
  88. }
  89.  
  90. stock GetPlayerCents(playerid)
  91. {
  92.     return GetPVarInt(playerid,"Cents");
  93. }
  94.  
  95. stock SetPlayerCash(playerid,dollars,cents)
  96. {
  97.     SetPVarInt(playerid,"Dollars",0);
  98.     SetPVarInt(playerid,"Cents",0);
  99.     GivePlayerCash(playerid,dollars,cents);
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement