SA-MP Forums Archive
Money not save - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Money not save (/showthread.php?tid=664503)



Money not save - helloah892 - 02.03.2019

I have a problem with my gamemode.My money is not save.Everytime when i spawm it always show my money to 0.Someone plz help me


Re: Money not save - SymonClash - 02.03.2019

Post code.


Re: Money not save - bosmania - 02.03.2019

You’re using a mysql database or any database?


Re: Money not save - helloah892 - 02.03.2019

i am using easydb


Re: Money not save - bosmania - 02.03.2019

Ur using some variables to save money and respect point etc in the database?


Re: Money not save - helloah892 - 02.03.2019

public OnPlayerConnect(playerid) {
g_Server[serverPlayers]++;

new
szBuffer[156]
;
format(szBuffer, sizeof(szBuffer), "Welcome to the Gta San Andreas Gangwars, now its have %i players!", g_Server[serverPlayers]);
SendClientMessage(playerid, COLOR_YELLOW, szBuffer);
SendClientMessage(playerid, COLOR_PINK, "If you are new here, do read /cmds for Server Commands, /rules for Server Rules.");
//SendClientMessage(playerid, COLOR_PINK, "Now you can pick dead player's weapons by pressing key \"N\" near one.");

g_Player[playerid][playerClassTxt][0] = CreatePlayerTextDraw(playerid,130.000000, 230.000000, "GROVE");
PlayerTextDrawBackgroundColor(playerid,g_Player[playerid][playerClassTxt][0], 255);
PlayerTextDrawFont(playerid,g_Player[playerid][playerClassTxt][0], 1);
PlayerTextDrawLetterSize(playerid,g_Player[playerid][playerClassTxt][0], 0.400000, 2.000000);
PlayerTextDrawColor(playerid,g_Player[playerid][playerClassTxt][0], 16711935);
PlayerTextDrawSetOutline(playerid,g_Player[playerid][playerClassTxt][0], 1);
PlayerTextDrawSetProportional(playerid,g_Player[playerid][playerClassTxt][0], 1);
PlayerTextDrawSetSelectable(playerid,g_Player[playerid][playerClassTxt][0], 0);

g_Player[playerid][playerClassTxt][1] = CreatePlayerTextDraw(playerid,130.000000, 247.000000, "Players: ~r~17 ~w~~h~out of ~r~122~n~~w~~h~You will be spawning with ~r~Ak-47, Combat shotgun, Desert eagle, Tear gas");
PlayerTextDrawBackgroundColor(playerid,g_Player[playerid][playerClassTxt][1], 255);
PlayerTextDrawFont(playerid,g_Player[playerid][playerClassTxt][1], 1);
PlayerTextDrawLetterSize(playerid,g_Player[playerid][playerClassTxt][1], 0.160000, 0.799999);
PlayerTextDrawColor(playerid,g_Player[playerid][playerClassTxt][1], -1);
PlayerTextDrawSetOutline(playerid,g_Player[playerid][playerClassTxt][1], 1);
PlayerTextDrawSetProportional(playerid,g_Player[playerid][playerClassTxt][1], 1);
PlayerTextDrawSetSelectable(playerid,g_Player[playerid][playerClassTxt][1], 0);

g_Player[playerid][playerSpawnTxt] = CreatePlayerTextDraw(playerid,10.000000, 160.000000, "Team ~b~~h~~h~Grove~n~~n~Weapons recieved!~n~Ak-47, Shotgun, Desert Eagle, Grenade, Brass knuckle~n~~n~You have spawn protection");
PlayerTextDrawBackgroundColor(playerid,g_Player[playerid][playerSpawnTxt], 255);
PlayerTextDrawFont(playerid,g_Player[playerid][playerSpawnTxt], 1);
PlayerTextDrawLetterSize(playerid,g_Player[playerid][playerSpawnTxt], 0.180000, 1.000000);
PlayerTextDrawColor(playerid,g_Player[playerid][playerSpawnTxt], -1);
PlayerTextDrawSetOutline(playerid,g_Player[playerid][playerSpawnTxt], 1);
PlayerTextDrawSetProportional(playerid,g_Player[playerid][playerSpawnTxt], 1);
PlayerTextDrawUseBox(playerid,g_Player[playerid][playerSpawnTxt], 1);
PlayerTextDrawBoxColor(playerid,g_Player[playerid][playerSpawnTxt], 200);
PlayerTextDrawTextSize(playerid,g_Player[playerid][playerSpawnTxt], 140.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid,g_Player[playerid][playerSpawnTxt], 0);

g_Player[playerid][playerOffradarTxt] = CreatePlayerTextDraw(playerid,10.000000, 238.000000, "You are now invisible in the map, that means you not visible on game map/map~n~~n~/invisible: ~r~~h~~h~50..");
PlayerTextDrawBackgroundColor(playerid,g_Player[playerid][playerOffradarTxt], 255);
PlayerTextDrawFont(playerid,g_Player[playerid][playerOffradarTxt], 1);
PlayerTextDrawLetterSize(playerid,g_Player[playerid][playerOffradarTxt], 0.180000, 1.000000);
PlayerTextDrawColor(playerid,g_Player[playerid][playerOffradarTxt], -1);
PlayerTextDrawSetOutline(playerid,g_Player[playerid][playerOffradarTxt], 1);
PlayerTextDrawSetProportional(playerid,g_Player[playerid][playerOffradarTxt], 1);
PlayerTextDrawUseBox(playerid,g_Player[playerid][playerOffradarTxt], 1);
PlayerTextDrawBoxColor(playerid,g_Player[playerid][playerOffradarTxt], 336860360);
PlayerTextDrawTextSize(playerid,g_Player[playerid][playerOffradarTxt], 140.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid,g_Player[playerid][playerOffradarTxt], 0);

g_Player[playerid][playerSpawnProtectTimer] = -1;
g_Player[playerid][playerOffradarTimer] = -1;

return 1;
}

public OnPlayerDisconnect(playerid, reason) {
g_Server[serverPlayers]--;

return 1;
}

public OnPlayerRequestClass(playerid, classid) {
PlayerTextDrawColor(playerid, g_Player[playerid][playerClassTxt][0], g_Team[classid][teamColor]);
PlayerTextDrawSetString(playerid, g_Player[playerid][playerClassTxt][0], g_Team[classid][teamName]);
PlayerTextDrawShow(playerid, g_Player[playerid][playerClassTxt][0]);

new
iTeamPlayer,
szBuffer[450],
szWeaponName[35]
;
for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
if (GetPlayerTeam(i) == g_Team[classid][teamId]) {
iTeamPlayer++;
}
}
format(szBuffer, sizeof(szBuffer), "Players: ~r~%i ~w~~h~out of ~r~%i~n~", iTeamPlayer, g_Server[serverPlayers]);
strcat(szBuffer, "~w~~h~You will be spawning with ~r~");
GetWeaponName(g_Team[classid][teamWeapon1][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[classid][teamWeapon2][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[classid][teamWeapon3][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[classid][teamWeaponThrown][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[classid][teamWeaponMelle], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
PlayerTextDrawSetString(playerid, g_Player[playerid][playerClassTxt][1], szBuffer);
PlayerTextDrawShow(playerid, g_Player[playerid][playerClassTxt][1]);

if (g_Player[playerid][playerSpawnProtectTimer] != -1) {
KillTimer(g_Player[playerid][playerSpawnProtectTimer]);
}
if (IsValidDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel])) {
DestroyDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel]);
}

if (g_Player[playerid][playerSpawnTxtTimer] != -1) {
KillTimer(g_Player[playerid][playerSpawnTxtTimer]);
}
OnSpawnTextdrawHide(playerid);

if (g_Player[playerid][playerOffradarTimer] != -1) {
KillTimer(g_Player[playerid][playerOffradarTimer]);
}
g_Player[playerid][playerOffradarTimer] = -1;
g_Player[playerid][playerLastOffradar] = 0;
PlayerTextDrawHide(playerid, g_Player[playerid][playerOffradarTxt]);

switch (g_Team[classid][teamId]) {
case 0: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 2524.1550, -1671.1104, 19.9203);
SetPlayerCameraLookAt(playerid, 2520.1550, -1671.1104, 19.4203);
SetPlayerPos(playerid, 2520.1550, -1671.1104, 19.4203);
SetPlayerFacingAngle(playerid, 270.0000);
}
case 1: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1948.655639, -1114.651733, 31.215576);
SetPlayerCameraLookAt(playerid, 1944.464599, -1117.156250, 30.137393);
SetPlayerPos(playerid,1945.0365,-1116.4506,30.757;
SetPlayerFacingAngle(playerid,295.8885);
}
case 2: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1512.555541, -1638.949829, 19.780670);
SetPlayerCameraLookAt(playerid, 1515.505371, -1642.952270, 19.252750);
SetPlayerPos(playerid,1514.8364,-1642.3707,19.2422);
SetPlayerFacingAngle(playerid,31.5911);
}
case 3: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 2631.425781, -1068.947387, 77.147903);
SetPlayerCameraLookAt(playerid, 2626.514404, -1068.871337, 76.214347);
SetPlayerPos(playerid,2626.9626,-1068.8726,75.9696);
SetPlayerFacingAngle(playerid,269.8981);
}
case 4: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1785.895385, -2094.484130, 18.303087);
SetPlayerCameraLookAt(playerid, 1787.589721, -2099.043457, 17.144950);
SetPlayerPos(playerid,1787.6921,-2099.0662,17.4470);
SetPlayerFacingAngle(playerid,31.671;
}
case 5: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1124.762329, -1191.299682, 33.81042;
SetPlayerCameraLookAt(playerid, 1122.427734, -1195.331298, 31.995071);
SetPlayerPos(playerid,1122.2896,-1195.3792,32.0313);
SetPlayerFacingAngle(playerid,326.1501);
}
case 6: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 869.850463, -973.024658, 41.405673);
SetPlayerCameraLookAt(playerid, 873.374816, -969.478149, 41.434577);
SetPlayerPos(playerid,873.1442,-969.5593,41.0649);
SetPlayerFacingAngle(playerid,141.9807);
}
default: {
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 2466.381591, -1644.103027, 18.203895);
SetPlayerCameraLookAt(playerid, 2470.127685, -1647.413452, 18.117961);
SetPlayerPos(playerid,2469.7090,-1646.9497,18.2023);
SetPlayerFacingAngle(playerid,53.1127);
}
}

g_Player[playerid][playerClass] = classid;

return 1;
}

public OnPlayerRequestSpawn(playerid) {
SendClientMessage(playerid, COLOR_KHAKI, "* You can change your team using /ct or /st or Press F4 key.");
return 1;
}

public OnPlayerSpawn(playerid) {
PlayerTextDrawHide(playerid, g_Player[playerid][playerClassTxt][0]);
PlayerTextDrawHide(playerid, g_Player[playerid][playerClassTxt][1]);

RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
g_Player[playerid][playerHelmet] = false;
RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
g_Player[playerid][playerMask] = false;

new
iRandom
;
switch (g_Team[g_Player[playerid][playerClass]][teamId]) {
case 0: {
iRandom = random(sizeof(g_SpawnGroves));
SetPlayerPos(playerid, g_SpawnGroves[iRandom][0], g_SpawnGroves[iRandom][1], g_SpawnGroves[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnGroves[iRandom][3]);
}
case 1: {
iRandom = random(sizeof(g_SpawnBallas));
SetPlayerPos(playerid, g_SpawnBallas[iRandom][0], g_SpawnBallas[iRandom][1], g_SpawnBallas[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnBallas[iRandom][3]);
}
case 2: {
iRandom = random(sizeof(g_SpawnCops));
SetPlayerPos(playerid, g_SpawnCops[iRandom][0], g_SpawnCops[iRandom][1], g_SpawnCops[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnCops[iRandom][3]);
}
case 3: {
iRandom = random(sizeof(g_SpawnVagos));
SetPlayerPos(playerid, g_SpawnVagos[iRandom][0], g_SpawnVagos[iRandom][1], g_SpawnVagos[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnVagos[iRandom][3]);
}
case 4: {
iRandom = random(sizeof(g_SpawnAztecas));
SetPlayerPos(playerid, g_SpawnAztecas[iRandom][0], g_SpawnAztecas[iRandom][1], g_SpawnAztecas[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnAztecas[iRandom][3]);
}
case 5: {
iRandom = random(sizeof(g_SpawnBikers));
SetPlayerPos(playerid, g_SpawnBikers[iRandom][0], g_SpawnBikers[iRandom][1], g_SpawnBikers[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnBikers[iRandom][3]);
}
case 6: {
iRandom = random(sizeof(g_SpawnBarbers));
SetPlayerPos(playerid, g_SpawnBarbers[iRandom][0], g_SpawnBarbers[iRandom][1], g_SpawnBarbers[iRandom][2]);
SetPlayerFacingAngle(playerid, g_SpawnBarbers[iRandom][3]);
}
}

SetPlayerTeam(playerid, g_Team[g_Player[playerid][playerClass]][teamId]);
SetPlayerSkin(playerid, g_Team[g_Player[playerid][playerClass]][teamSkin]);
SetPlayerColor(playerid, g_Team[g_Player[playerid][playerClass]][teamColor]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, g_Team[g_Player[playerid][playerClass]][teamWeapon1][0], g_Team[g_Player[playerid][playerClass]][teamWeapon1][1]);
GivePlayerWeapon(playerid, g_Team[g_Player[playerid][playerClass]][teamWeapon2][0], g_Team[g_Player[playerid][playerClass]][teamWeapon2][1]);
GivePlayerWeapon(playerid, g_Team[g_Player[playerid][playerClass]][teamWeapon3][0], g_Team[g_Player[playerid][playerClass]][teamWeapon3][1]);
GivePlayerWeapon(playerid, g_Team[g_Player[playerid][playerClass]][teamWeaponThrown][0], g_Team[g_Player[playerid][playerClass]][teamWeaponThrown][1]);
GivePlayerWeapon(playerid, g_Team[g_Player[playerid][playerClass]][teamWeaponMelle], 1);

for (new i; i < MAX_PLAYERS; i++) {
SetPlayerMarkerForPlayer(i, playerid, (g_Team[g_Player[playerid][playerClass]][teamColor] | 0xFFFFFFFF));
}

SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerHealth(playerid, FLOAT_INFINITY);

new
szBuffer[450],
szWeaponName[35]
;
strcat(szBuffer, "Team ~b~~h~~h~");
strcat(szBuffer, g_Team[g_Player[playerid][playerClass]][teamName]);
strcat(szBuffer, "~n~~n~Weapons recieved!~n~");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon1][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon2][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon3][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeaponThrown][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeaponMelle], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, "~n~~n~You have spawn protection [5 secs]");
PlayerTextDrawSetString(playerid, g_Player[playerid][playerSpawnTxt], szBuffer);
PlayerTextDrawShow(playerid, g_Player[playerid][playerSpawnTxt]);

if (g_Player[playerid][playerSpawnProtectTimer] != -1) {
KillTimer(g_Player[playerid][playerSpawnProtectTimer]);
}
if (IsValidDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel])) {
DestroyDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel]);
}
g_Player[playerid][playerSpawnProtectLabel] = CreateDynamic3DTextLabel("Spawn Protection", COLOR_RED, 0.0, 0.0, 0.7, 20.0, playerid, _, 1);
g_Player[playerid][playerSpawnProtectTimer] = SetTimerEx("OnSpawnProtectionOver", 5000, false, "iff", playerid, 100.0, 10.0);

if (g_Player[playerid][playerSpawnTxtTimer] != -1) {
KillTimer(g_Player[playerid][playerSpawnTxtTimer]);
}
g_Player[playerid][playerSpawnTxtTimer] = SetTimerEx("OnSpawnTextdrawHide", 15000, false, "i", playerid);

if (g_Player[playerid][playerOffradarTimer] != -1) {
KillTimer(g_Player[playerid][playerOffradarTimer]);
}
g_Player[playerid][playerOffradarTimer] = -1;
g_Player[playerid][playerLastOffradar] = 0;
PlayerTextDrawHide(playerid, g_Player[playerid][playerOffradarTxt]);

g_Player[playerid][playerLastRefill] = 0;
g_Player[playerid][playerLastAmmoBoost] = 0;

SendClientMessage(playerid, COLOR_YELLOW, "* If you want to go invisible in the map,use the command /invisible.");
SendClientMessage(playerid, COLOR_YELLOW, "* Use /hp in case you are injured, /ar for an additional armour and /shop for other instant stuff.");

return 1;
}

forward OnSpawnProtectionOver(playerid, Float:h, Float:a);
public OnSpawnProtectionOver(playerid, Float:h, Float:a) {
SetPlayerHealth(playerid, h);
SetPlayerArmour(playerid, a);

g_Player[playerid][playerSpawnProtectTimer] = -1;

if (IsValidDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel])) {
DestroyDynamic3DTextLabel(g_Player[playerid][playerSpawnProtectLabel]);
}

new
szBuffer[450],
szWeaponName[35]
;
strcat(szBuffer, "Team ~b~~h~~h~");
strcat(szBuffer, g_Team[g_Player[playerid][playerClass]][teamName]);
strcat(szBuffer, "~n~~n~Weapons recieved!~n~");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon1][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon2][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeapon3][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeaponThrown][0], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, ", ");
GetWeaponName(g_Team[g_Player[playerid][playerClass]][teamWeaponMelle], szWeaponName, sizeof(szWeaponName));
strcat(szBuffer, szWeaponName);
strcat(szBuffer, "~n~~n~~r~~h~~h~Spawn protection over!");
PlayerTextDrawSetString(playerid, g_Player[playerid][playerSpawnTxt], szBuffer);
PlayerTextDrawShow(playerid, g_Player[playerid][playerSpawnTxt]);
}