23.12.2011, 09:01
Hello friends.I want to ask how to make the player to sign up, select gender and then spawn?
Here is my GM :
Here is my GM :
pawn Код:
//Includes
//Ir kiti
#include <a_samp>
#include <Dini>
#include <foreach>
#include <zcmd>
//Defines
#define VERSIJA "1.0"
#define PAVADINIMAS "A-V-G"
#define REGAS 1
#define LOGINAS 2
//Forward
forward Saugojimas( playerid );
forward Uzkrovimas( playerid );
//Scriptfiles/vartotojai=kintamieji
enum Zaidejams
{
lytis,
drabuziai,
admin,
busena
}
new PDB[MAX_PLAYERS][Zaidejams];
new FirstConnect[MAX_PLAYERS] = 0;
main()
{
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
print("///////////////////Antrasis-Virtualus-Gyvenimas * 2011///////");
print("/// Modifikacija kurta by : ///");
print("/// CiriLX ir .weeD ///");
print("/////////////////////////////////////////////////////////////");
print("\n\n\n\n\n\n\n");
}
public OnGameModeInit()
{
AddPlayerClass(0,-2654.9724,639.2270,14.4531,181.9655, 0, 0, 0, 0, 0, 0);
AddPlayerClass(0,-2654.9724,639.2270,14.4531,181.9655, 0, 0, 0, 0, 0, 0);
SetGameModeText(PAVADINIMAS VERSIJA);
return 1;
}
public OnGameModeExit()
{
SendClientMessageToAll( -1, "!!!!!!!!!!!!!!!!!!!!!!!ATSIPRASOME SERVERIS LAIKINAI ISJUNGIAMAS!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
new failas[128], vardas[128];
GetPlayerName(playerid, vardas, 128);
format(failas,128,"vartotojai/%s.ini",vardas);
if(!dini_Exists(failas))
{
ShowPlayerDialog(playerid,REGAS,DIALOG_STYLE_INPUT,"Registracija","Iveskite slaptazodi","Registruotis","");
}
else if(dini_Exists(failas))
{
ShowPlayerDialog(playerid,LOGINAS,DIALOG_STYLE_INPUT,"Prisijungimas","Iveskite slaptazodi","Prisijungti","");
}
TogglePlayerSpectating(playerid, 1);
FirstConnect[playerid] = 1;
SetSpawnInfo(playerid,0,0,-2654.9724,639.2270,14.4531,181.9655, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Saugojimas( playerid );
return 1;
}
public OnPlayerSpawn(playerid)
{
if(FirstConnect[playerid] == 1)
{
TogglePlayerSpectating(playerid, 0);
FirstConnect[playerid] = 0;
}
PDB[ playerid ][ admin ] = false;
Uzkrovimas( playerid );
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[])
{
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[])
{
if(dialogid == 10)
{
if(response)
{
SendClientMessage(playerid,0xFFFFFFFF," Taigi, jus esate Vyras.");
SetPlayerSkin(playerid,188);
PDB[playerid][lytis]=1;
}
}
if(!response)
{
SendClientMessage(playerid,0xFFFFFFFF," Taigi, jus esate Moteris.");
SetPlayerSkin(playerid,93);
PDB[playerid][lytis]=0;
return 1;
}
if(dialogid == 1)
{
if(response)
{
new file[128], name[128];
GetPlayerName(playerid,name,128);
format(file,128,"vartotojai/%s.ini",name);
dini_Create(file);
dini_Set(file,"slaptazodis",inputtext);
ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX," Lytis "," Pasirinkite lyti","Vyras","Moteris");
SendClientMessage(playerid,0xFFFFFFFF,"JUS UZREGISTRUOTAS!ACIU!");
GivePlayerMoney(playerid,20000);
SetPlayerScore(playerid,1000);
Saugojimas( playerid );
}
else if(!response)
{
Kick( playerid );
}
return 1;
}
if(dialogid == 2)
{
if(response)
{
new name[MAX_PLAYER_NAME],file[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"vartotojai/%s.ini",name);
if(CheckPass(file,inputtext))
{
new zinute[20],vardas[MAX_PLAYER_NAME];
GetPlayerName(playerid,vardas,MAX_PLAYER_NAME);
format(zinute,sizeof(zinute),"Labas %s , gero zaidimo",vardas);
SendClientMessage(playerid,-1,zinute);
}
}
return 1;
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock CheckPass(file[],password[])
{
if(!strcmp(dini_Get(file,"slaptazodis"), password, true )) return true;
return false;
}
public Saugojimas(playerid)
{
new file[100];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"vartotojai/%s.ini",name);
new Float:coo[3],weps[2][12];
GetPlayerPos(playerid,coo[0],coo[1],coo[2]);
if(!fexist(file)){dini_Create(file);}
dini_IntSet(file,"Patirtis",GetPlayerScore(playerid));
dini_IntSet(file,"Admin",PDB[playerid][admin]);
dini_IntSet(file,"Lytis",PDB[playerid][lytis]);
dini_IntSet(file,"Drabuziai",PDB[playerid][drabuziai]);
for (new tmp=0; tmp<12; tmp++) GetPlayerWeaponData(playerid,tmp,weps[0][tmp],weps[1][tmp]);
dini_IntSet(file,"Ginklas0",weps[0][0]); dini_IntSet(file,"Ammo0",weps[1][0]);
dini_IntSet(file,"Ginklas1",weps[0][1]); dini_IntSet(file,"Ammo1",weps[1][1]);
dini_IntSet(file,"Ginklas2",weps[0][2]); dini_IntSet(file,"Ammo2",weps[1][2]);
dini_IntSet(file,"Ginklas3",weps[0][3]); dini_IntSet(file,"Ammo3",weps[1][3]);
dini_IntSet(file,"Ginklas4",weps[0][4]); dini_IntSet(file,"Ammo4",weps[1][4]);
dini_IntSet(file,"Ginklas5",weps[0][5]); dini_IntSet(file,"Ammo5",weps[1][5]);
dini_IntSet(file,"Ginklas6",weps[0][6]); dini_IntSet(file,"Ammo6",weps[1][6]);
dini_IntSet(file,"Ginklas7",weps[0][7]); dini_IntSet(file,"Ammo7",weps[1][7]);
dini_IntSet(file,"Ginklas8",weps[0][8]); dini_IntSet(file,"Ammo8",weps[1][8]);
dini_IntSet(file,"Ginklas9",weps[0][9]); dini_IntSet(file,"Ammo9",weps[1][9]);
dini_IntSet(file,"Ginklas10",weps[0][10]); dini_IntSet(file,"Ammo10",weps[1][10]);
dini_IntSet(file,"Ginklas11",weps[0][11]); dini_IntSet(file,"Ammo11",weps[1][11]);
dini_FloatSet(file,"pos_X",coo[0]); dini_FloatSet(file,"pos_Y",coo[1]); dini_FloatSet(file,"pos_Z",coo[2]);
return 1;
}
public Uzkrovimas(playerid)
{
new name[MAX_PLAYER_NAME],file[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"vartotojai/%s.ini",name);
if(!fexist(file)) return;
new tmpxp = dini_Int(file,"Xp");
SetPlayerScore(playerid,tmpxp);
SetPlayerPos(playerid,dini_Float(file,"pos_X"),dini_Float(file,"pos_Y"),dini_Float(file,"pos_Z"));
PDB[playerid][admin] = dini_Int(file,"Admin");
PDB[playerid][lytis] = dini_Int(file,"Lytis");
PDB[playerid][drabuziai] = dini_Int(file,"Drabuziai");
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas0"),dini_Int(file,"Ammo0"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas1"),dini_Int(file,"Ammo1"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas2"),dini_Int(file,"Ammo2"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas3"),dini_Int(file,"Ammo3"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas4"),dini_Int(file,"Ammo4"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas5"),dini_Int(file,"Ammo5"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas6"),dini_Int(file,"Ammo6"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas7"),dini_Int(file,"Ammo7"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas8"),dini_Int(file,"Ammo8"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas9"),dini_Int(file,"Ammo9"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas10"),dini_Int(file,"Ammo10"));
GivePlayerWeapon(playerid,dini_Int(file,"Ginklas11"),dini_Int(file,"Ammo11"));
return;
}