[Problem]Saving
#1

what is problem when i enter game and when i use terrorists or cops
and when i left game he save my team and when i enter again he say to me again same team.with this fs


Код:
#include <a_samp>
#define COLOR_RED 0xFF0000AA
#define COLOR_BLUE 0x0000BBAA
#define SCM




new PostaviTim[MAX_PLAYERS];
new PlantedBomb = 0;


public OnGameModeInit()
{
return 1;
}


public OnGameModeExit()
{
return 1;
}


public OnPlayerRequestClass(playerid, classid)
{
return 1;
}


public OnPlayerConnect(playerid)
{
    PostaviTim[playerid] = 0;
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
return 1;
}


public OnPlayerSpawn(playerid)
{
	if (PostaviTim[playerid] == 0)
	{
	    new Tim = random(2);
	  	switch(Tim)
	   	{
	    	case 0:
	     	{
	     	    PostaviTim[playerid] = 1;
	     	    //SetPlayerSkin(playerid, ID Skina); // Ovo stavi ako hoces
	     	}
	     	case 1:
	     	{


	     	    PostaviTim[playerid] = 2;
	     	    //SetPlayerSkin(playerid, ID Skina); // Ovo stavi ako hoces
	     	}
	    }
    }
	return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}


public OnVehicleSpawn(vehicleid)
{
return 1;
}


public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}


public OnPlayerText(playerid, text[])
{
return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/plantbomb", cmdtext, true, 10) == 0)
	{
	    if (PostaviTim[playerid] == 2) return SendClientMessage (playerid, COLOR_RED, "Cops can't plant bomb");
		if (!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,1820.3402,6.4216)) return SendClientMessage(playerid,COLOR_RED,"You are not in the place for planting the bomb");
		if (PlantedBomb == 1) return SendClientMessage(playerid,COLOR_RED,"The bomb is already planted!");
		PlantedBomb = 1;
		GameTextForAll("~r~Bomb has been planted!",3000,5);
		SetTimer("Explosion",300000,0);
	}


	if (strcmp("/defusebomb", cmdtext, true, 10) == 0)
	{
	    if (PlantedBomb == 0) return SendClientMessage(playerid,COLOR_RED,"The bomb is not planted!");
		if (PostaviTim[playerid] == 2)
		{
			if (!IsPlayerInRangeOfPoint(playerid,2.0,212.9239,1820.3402,6.4216)) return SendClientMessage(playerid,COLOR_RED,"You are not in the place for planting the bomb");
			SendClientMessage(playerid,COLOR_RED,"You are defusing a bomg, please wait.");
			SetTimer("Defusion",20000,0);
		}
		else
		{
			SendClientMessage (playerid, COLOR_RED, "Only cops can defuse bomb");
		}
	}
	return 0;
}
forward Explosion(playerid);
public Explosion(playerid)
{
	GameTextForAll("~r~Bomb exploded",6000,5);
	CreateExplosion(212.9239,1820.3402,6.4216,12,20.0) ;
	GivePlayerMoney(playerid,10000);
	SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
        PlantedBomb = 0;
	return 1;
}
forward Defusion(playerid);
public Defusion(playerid)
{
	KillTimer(0);
	GameTextForAll("~r~Bomb defused",6000,5);
	GivePlayerMoney(playerid,10000);
	SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);
	return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}


public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}


public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}


public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}


public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}


public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}


public OnRconCommand(cmd[])
{
return 1;
}


public OnPlayerRequestSpawn(playerid)
{
return 1;
}


public OnObjectMoved(objectid)
{
return 1;
}


public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}


public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}


public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}


public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}


public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}


public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}


public OnPlayerExitedMenu(playerid)
{
return 1;
}


public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}


public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}


public OnPlayerUpdate(playerid)
{
return 1;
}


public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}


public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}


public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}


public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}


public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
Reply
#2

what is probleemm?
Reply
#3

Quote:

public OnPlayerConnect(playerid)
{
PostaviTim[playerid] = 0;
return 1;
}

I also don't see a register/login system?
Reply
#4

i have register/login system at gamemode
Reply
#5

I would add this FS into your game mode then add the team variables under the register / login system, if you want them to be set to a team on login.

You want them to select a team each time they login?
Reply
#6

yes but idk how to add it at gamemode
Reply
#7

how to add it at gamemode ?? i have JL administration system v1.0 beta

https://sampforum.blast.hk/showthread.php?tid=427582
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)