Jump to content
  • 0

pomoc VIP


Firess0

Dotaz

10 odpovědí na tuto otázku

Recommended Posts

  • 0

Počítám že MySQL asi nepoužíváš takže použij dini.

Není na tom nic složitého...

 

Někam do módu si dej new VIP[MAX_PLAYERS];

 

Do OnPlayerConnect nad to dej ještě VIP[playerid] = 0;

	new file[128], 
            dnudokoncevip = gettime(); //zjistí aktuální čas
	format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid)); //najde hráče nick v Vip složce
	if(fexist(file)){ //zjistí jestli existuje
		dnudokoncevip = dini_Int(file,"VipCas"); //porovná aktuální čas s časem uloženým při dání vip
		if(dnudokoncevip < gettime()){ // zjistí jestli je aktuální čas větší jak čas uložený při dání vip
			SCM(playerid, -1, "Vip ti vypršelo."); //napíše zprávu hráči
			VIP[playerid] = 0; //sebere vip
			dini_Remove(file); //smaže hráče ze složky Vip
		}else{ //pokud mu ještě vip nekončí
			VIP[playerid] = 1; //nastaví vip
		}
	}

VIP nastavíš

new dnudokoncevip = gettime()+mktime(0,0,0,POCET DNI,0,0); //udelej si new vipdays = strval(inputtext); třeba a místo POCET DNI dej vipdays
new file[128];
format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid));
dini_Create(file); //vytvoří do Vip hráčenick.txt
dini_IntSet(file,"VipCas",dnudokoncevip); //uloží to čas kdy má vip končit
VIP[playerid] = 1; //nastaví vip

Sežeň si ale stock na mktime a taky includ dini + stock playername a abych nezapomněl já využívám SCM místo SendClientMessage

je to kratší jestli to chceš taky dej si nahoru do módu definici

 

#define SCM SendClientMessage

Edited by rEf
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0

Ja ešte sa iba učím pawno takže nemohol by si mi popísať // načo to je každý riadok a pridať tam aspoň 1 príkaz ktorý môže použiť iba vip ??

Abi som to pochopil a nie kopíroval ako niektorý :d 

Link to comment
Share on other sites

  • 0

Ten příkaz uděláš jednoduše že si dáš nahoru do příkazu: if(VIP[playerid] == 0) return SendClientMessage(playerid, -1, "Nejsi vip hráč.");

Link to comment
Share on other sites

  • 0

takto ?? 

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(VIP[playerid] == 0) return SendClientMessage(playerid, -1, "Nejsi vip hráč.");
SetPlayerAmmo(playerid, 10, 10);
return 1;
}
return 0;
}
 
 
 
 
1. a musím mať vytvorenú zložku vip ??
2. Ako mu mam nastaviť to vip
Link to comment
Share on other sites

  • 0

1. Ano takto.

2. Do scriptfiles si uděláš složku: Vip

3. Jak to nastavit sem ti tam dal a popsal stačí si to udělat do dialogu jak jsi psal nebylo řeč o tom že ti budu dělat ještě dialog.

  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0

tak pomožeš ??

Alebo niekto by mi nepomohol ??


Počítám že MySQL asi nepoužíváš takže použij dini.

Není na tom nic složitého...

 

Někam do módu si dej new VIP[MAX_PLAYERS];

 

Do OnPlayerConnect nad to dej ještě VIP[playerid] = 0;

	new file[128], 
            dnudokoncevip = gettime(); //zjistí aktuální čas
	format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid)); //najde hráče nick v Vip složce
	if(fexist(file)){ //zjistí jestli existuje
		dnudokoncevip = dini_Int(file,"VipCas"); //porovná aktuální čas s časem uloženým při dání vip
		if(dnudokoncevip < gettime()){ // zjistí jestli je aktuální čas větší jak čas uložený při dání vip
			SCM(playerid, -1, "Vip ti vypršelo."); //napíše zprávu hráči
			VIP[playerid] = 0; //sebere vip
			dini_Remove(file); //smaže hráče ze složky Vip
		}else{ //pokud mu ještě vip nekončí
			VIP[playerid] = 1; //nastaví vip
		}
	}

VIP nastavíš

new dnudokoncevip = gettime()+mktime(0,0,0,POCET DNI,0,0); //udelej si new vipdays = strval(inputtext); třeba a místo POCET DNI dej vipdays
new file[128];
format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid));
dini_Create(file); //vytvoří do Vip hráčenick.txt
dini_IntSet(file,"VipCas",dnudokoncevip); //uloží to čas kdy má vip končit
VIP[playerid] = 1; //nastaví vip

Sežeň si ale stock na mktime a taky includ dini + stock playername a abych nezapomněl já využívám SCM místo SendClientMessage

je to kratší jestli to chceš taky dej si nahoru do módu definici

 

#define SCM SendClientMessage

 

 

 

kde mam dať to VIP[playerid] = 0; ??

a toto čo je pod tim VIP nastaviš

 

 

 

 

 

 

 

 

niečo som z toho poskladal :d :D 

 

#include <a_samp>
#include <dini>
#define SCM SendClientMessage
new VIP[MAX_PLAYERS];
 
public OnGameModeInit()
{
        // Don't use these lines if it's a filterscript
        SetGameModeText("Blank Script");
        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        return 1;
}
 
stock mktime(hour,minute,second,day,month,year) {
   new timestamp2;
 
   timestamp2 = second + (minute * 60) + (hour * 3600);
 
   new days_of_month[12];
 
   if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) {
         days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
      } else {
         days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // keins
      }
   new days_this_year = 0;
   days_this_year = day;
   if(month > 1) { // No January Calculation, because its always the 0 past months
      for(new i=0; i<month-1;i++) {
         days_this_year += days_of_month;
      }
   }
   timestamp2 += days_this_year * 86400;
 
   for(new j=1970;j<year;j++) {
      timestamp2 += 31536000;
      if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )  timestamp2 += 86400; // Schaltjahr + 1 Tag
   }
 
   return timestamp2;
}
 
public OnGameModeExit()
{
        return 1;
}
 
public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        return 1;
}
 
public OnPlayerConnect(playerid)
{
     VIP[playerid] = 0;
     new file[128],
     dnudokoncevip = gettime(); //zjistí aktuální čas
format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid)); //najde hráče nick v Vip složce
    if(fexist(file)){ //zjistí jestli existuje
     dnudokoncevip = dini_Int(file,"VipCas"); //porovná aktuální čas s časem uloženým při dání vip
     if(dnudokoncevip < gettime()){ // zjistí jestli je aktuální čas větší jak čas uložený při dání vip
SCM(playerid, -1, "Vip ti vypršelo."); //napíše zprávu hráči
VIP[playerid] = 0; //sebere vip
dini_Remove(file); //smaže hráče ze složky Vip
}else{ //pokud mu ještě vip nekončí
VIP[playerid] = 1; //nastaví vip
}
}
     return 1;
}
 
stock PlayerName(playerid)
{
   new pName[MAX_PLAYER_NAME];
   if(IsPlayerConnected(playerid))
   {
         GetPlayerName(playerid, pName, sizeof(pName));
   }
   return pName;
}
 
public OnPlayerDisconnect(playerid, reason)
{
        return 1;
}
 
public OnPlayerSpawn(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[])
{
        if (strcmp("/setvip", cmdtext, true, 10) == 0)
        {
new dnudokoncevip = gettime()+mktime(0,0,0,POCET DNI,0,0); //udelej si new vipdays = strval(inputtext); třeba a místo POCET DNI dej vipdays
new file[128];
format(file,sizeof(file),"Vip/%s.txt",PlayerName(playerid));
dini_Create(file); //vytvoří do Vip hráčenick.txt
dini_IntSet(file,"VipCas",dnudokoncevip); //uloží to čas kdy má vip končit
VIP[playerid] = 1; //nastaví vip
                return 1;
        }
        return 0;
}
 
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;
}

lock

Edited by Firess0
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...