SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/05/2020, 01:52 PM   #1
Extremac
Big Clucker
 
Join Date: Sep 2018
Posts: 48
Reputation: 0
Exclamation A few small problems, urgent!

Hi, I have a few small problems, in several systems, I have tried everything but I do not know how to solve them.



2.2. When a player in a dialog wants to change the spawn location, nothing happens, a new spawn location will not be saved and no message will be printed in the chat that he has changed the spawn.

Code:
		if(dialogid == DIALOG_SPAWN)
		{
			if(!response) { return 1; }
	  		switch(listitem)
			{
			case 0:
			{
                if(PlayerInfo[playerid][pSobaMotelC] < 0)
			    {
				PlayerInfo[playerid][pSpawn] = SPAWN_MOTELC;
				SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu Centru u BG");
				SavePlayer(playerid);
				}
				else return SendClientMessage(playerid,-1,"Nemate iznajmljenu sobu u tom motelu!");
			}
			case 1:
			{
			    if(PlayerInfo[playerid][pSobaMotelJeff] < 0)
			    {
			     PlayerInfo[playerid][pSpawn] = SPAWN_MOTELJEFF;
				 SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu JEFF u BG");
    			 SavePlayer(playerid);
				}
				else return SCM(playerid, -1, ""CRVENA"[MC:RP] "SIVA"Niste clan organizacije!");
			}
		}
	}
}
3.
I made a system of illness, and after testing I put the player 60 seconds, and it goes back to 0, when it comes to 0 the player gets sick and the player has to go to the hospital to be cured, when he is cured he is given 60 seconds again and goes back to 0. But the problem is that the timer doesn't repeat it, so it goes 60 then 59, and it doesn't go down anymore, it just stops.

Code, where the player goes seconds back and when it reaches 0, the player gets sick.
Code:
public UpdateBolest(playerid)
{
  new string[256];
  PlayerInfo[playerid][pBolestVrijeme]  --;
  format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~y~BOLEST VAM DOLAZI~n~ZA: %d", PlayerInfo[playerid][pBolestVrijeme]);
  GameTextForPlayer(playerid, string, 1000, 3);
  if(PlayerInfo[playerid][pBolestVrijeme] > 0)
  {
  PlayerInfo[playerid][pBolestan] = 1;
  PlayerInfo[playerid][pBolestVrijeme] = 0;
  KillTimer(BolestTimer[playerid]);
  }
  return 1;
}
This is when the player registers and spawns, and is set to 60, seconds and the timer starts, there is a problem that the seconds are haircut to 59, seconds. I will mark with a few slashes.

Code:
public Tutorial(playerid)
{
new rand = random(sizeof(RandomSpawn));
OcistiChat(playerid,10);
PlayerInfo[playerid][pReg] = 1;
PlayerInfo[playerid][pZavrsenaReg] = 1;
PlayerInfo[playerid][pNovacDzep] = 10000; GivePlayerMoney(playerid, PlayerInfo[playerid][pNovacDzep]);
PlayerInfo[playerid][pLevel] = 1; SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); 
if(PlayerInfo[playerid][pPol] == 1) { SetPlayerSkin(playerid, 60); PlayerInfo[playerid][pSkin] = 60; }
if(PlayerInfo[playerid][pPol] == 2) { SetPlayerSkin(playerid, 40); PlayerInfo[playerid][pSkin] = 40; }
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2], RandomSpawn[rand][3], 0, 0, 0, 0, 0, 0);
SetCameraBehindPlayer(playerid); SpawnPlayer(playerid); SpawnIgraca(playerid);
////////PlayerInfo[playerid][pBolestVrijeme] = 60; BolestTimer[playerid] = SetTimer("UpdateBolest", 1000, 1);//////
TogglePlayerControllable(playerid, 1); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0);
SavePlayer(playerid);
return 1;
}
This is when the player logs in and spawns, his countdown continues to 0, but even here he freezes at 59 seconds. I will mark with a few slashes.

Code:
public SpawnIgrac(playerid)
{
					new string[256],tmp2[128];
					new playername2[MAX_PLAYER_NAME];
	                GetPlayerName(playerid, playername2, sizeof(playername2));
					format(string,sizeof(string),""ZUTA"||---------------------------------------------------------||.");
					SendClientMessage(playerid,-1,string);
					format(string,sizeof(string),"Pozz tebra, %s. Dobrodosao na nas server",GetName(playerid));
					SendClientMessage(playerid,COLOR_YELLOW,string);
					format(string,sizeof(string),""BELA"[INFO]: "BELA"Trenutni Level: [%d].",PlayerInfo[playerid][pLevel]);
					SendClientMessage(playerid,-1,string);
					SCMF(playerid,-1,"[INFO]: Trenutno novca u dzepu: [%d]",PlayerInfo[playerid][pNovacDzep]);
					SCMF(playerid,-1,"[INFO]: Trenutno novca u banci: [%d]",PlayerInfo[playerid][pBanka]);
					format(tmp2, sizeof(tmp2), "~w~Dobrodosao/la ~n~~y~   %s", playername2);
					GameTextForPlayer(playerid, tmp2, 5000, 1);
					///////BolestTimer[playerid] = SetTimer("UpdateBolest", 1000, 1);
					return 1;
}
This is that the player has to be in the hospital and there he is cured and again he is given 60, seconds and goes backwards but there is also a problem, and 59, he is released.

Code:
YCMD:lijecenje(playerid,params[],help)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, -6.2084,148.3371,999.0519))
{
if(PlayerInfo[playerid][pBolestan] < 1) return SCM(playerid,-1,"Niste bolestani!");
if(PlayerInfo[playerid][pNovacDzep] < 15) return SCM(playerid,-1,"Nemate dovoljno novca(15.dinara)");
NovacMinus(playerid,15);
SCM(playerid,-1,"Izlecili ste se za 15. dinara");
PlayerInfo[playerid][pBolestan] = 0;
///////PlayerInfo[playerid][pBolestVrijeme] = 60;
/////BolestTimer[playerid] = SetTimer("UpdateBolest", 1000, 1);
SavePlayer(playerid);
}
else return SCM(playerid,-1,"Niste na mjestu u Bolnici!");
return 1;
}

Last edited by Extremac; 29/05/2020 at 09:49 PM. Reason: Update:
Extremac is offline   Reply With Quote
Old 29/05/2020, 09:49 PM   #2
Extremac
Big Clucker
 
Join Date: Sep 2018
Posts: 48
Reputation: 0
Default Re: A few small problems, urgent!

Update:
As for problem number 1. I solved it by rebuilding the system, but if you can urgently solve these 2. other problems, because I need
Extremac is offline   Reply With Quote
Old 30/05/2020, 09:52 AM   #3
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: A few small problems, urgent!

2.2

If statements are probably wrong.. You are looking to see if the pSobaMotelC is less than 0 probably looking more than zero..

3
Same thing you are killing the timer cause the BolestVrijeme if statement is more than 0 and it runs the KillTimer.

You shouldn't do it like this just use the global timer inside your script which checks the paydaytime or jailtime..
Runn3R is offline   Reply With Quote
Old 30/05/2020, 02:57 PM   #4
Extremac
Big Clucker
 
Join Date: Sep 2018
Posts: 48
Reputation: 0
Exclamation Re: A few small problems, urgent!

Quote:
Originally Posted by Runn3R View Post
2.2

If statements are probably wrong.. You are looking to see if the pSobaMotelC is less than 0 probably looking more than zero..

3
Same thing you are killing the timer cause the BolestVrijeme if statement is more than 0 and it runs the KillTimer.

You shouldn't do it like this just use the global timer inside your script which checks the paydaytime or jailtime..
As for problem 2. I solved it thank you very much! But this 3rd nusam, I changed the statements, but again the same, please room system and if you can set me pSobaMotelC and pSobaMotelJeff, and all right, I would be very grateful. I also have another dialogue where when I click, nothing happens. I don't know what it's about. And this second dialog, on that dialog I choose whether to see the list online or the list of all admins.


Room system:

Code:
YCMD:iznajmisobu(playerid,params[],help)
{
     if(PlayerInfo[playerid][pSobaMotelC] == 1) return SCM(playerid,-1,""ZUTA"Vec imate iznajmljenu sobu!");
     if(PlayerInfo[playerid][pSobaMotelJeff] == 1) return SCM(playerid,-1,""ZUTA"Vec imate iznajmljenu sobu!");
	 if(IsPlayerInRangeOfPoint(playerid, 4.0, -256.6187,-129.7915,-41.0062))
	 {
	 SCMF(playerid,-1,"Iznajmili ste sobu u Motelu Centru u Beogradu.");
	 SCMF(playerid,-1,"Sobu cete placati svaku platu po 100. dinara");
	 PlayerInfo[playerid][pSobaMotelC] = 1;
	 }
	 if(IsPlayerInRangeOfPoint(playerid, 4.0, 2217.3374,-1146.4050,1025.7969))
	 {
	 SCMF(playerid,-1,"Iznajmili ste sobu u Motelu Jeffersonu u Beogradu.");
	 SCMF(playerid,-1,"Sobu cete placati svaku platu po 100. dinara");
	 PlayerInfo[playerid][pSobaMotelJeff] = 1;
	 }
   return 1;
}
Code:
		if(dialogid == DIALOG_SPAWN)
		{
			if(!response)  return 1;
	  		switch(listitem)
			{
			case 0:
			{
                if(PlayerInfo[playerid][pSobaMotelC] < 1)
			    {
				PlayerInfo[playerid][pSpawn] = SPAWN_MOTELC;
				SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu Centru u BG");
				SavePlayer(playerid);
				}
				else return SendClientMessage(playerid,-1,"Nemate iznajmljenu sobu u tom motelu!");
			}
			case 1:
			{
			    if(PlayerInfo[playerid][pSobaMotelJeff] < 1)
			    {
			     PlayerInfo[playerid][pSpawn] = SPAWN_MOTELJEFF;
				 SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu JEFF u BG");
    			 SavePlayer(playerid);
				}
				else return SCM(playerid, -1, ""CRVENA"[MC:RP] "SIVA"Nemate iznajmljenu sobu u tom motelu!");
			}
		}
	}
2. Dialog list online and all admins

Code:
	    if(dialogid == DIALOG_ADMINLIST && response)
		{
			//if(!response) { return 1; }
	  		switch(listitem)
			{
			case 0:
			{
                new str1[512], str2[2048];
				for(new i = 1; i < MAX_ADMINS; i++)
				{
				    if(!strcmp(AdminInfo[i][aAdmin], "Niko", false))
					{
						format(str1, sizeof(str1), "{FFFFFF}S-%d: %s ", i, AdminInfo[i][aAdmin]);
						strcat(str2, str1);
						strcat(str2, "\n");
					}
					else
  					{
						format(str1, sizeof(str1), "{FFFFFF}S-%d: %s | Level: %d | Neaktivnost: %d h", i, AdminInfo[i][aAdmin],AdminInfo[i][aRank],AdminInfo[i][aNeaktivnost]);
						strcat(str2, str1);
						strcat(str2, "\n");
  					}
				}
				ShowPlayerDialog(playerid, DIALOG_SVIADMINI, DIALOG_STYLE_MSGBOX, ""CRVENA"Lista Svih Admina", str2, "Zatvori", "");
			}
			case 1:
			{
			        new string[1024];
					format(string, sizeof(string), "");
					foreach(Player, i)
					{
						if (PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 6)
						{
							new atext[20];
							strcat(string, "{F81414}");
							strcat(string, GetName(i));
							strcat(string, "{FFFFFF} | ");
							strcat(string, "{F81414}Admin nivo: {FFFFFF}");
							format(atext, sizeof(atext), "%d", PlayerInfo[i][pAdmin]);
							strcat(string, atext);
				            if(AdminDuty[i] == 0)
						    {
				            	strcat(string, "{FFFFFF} | {F81414}Status: {FFFFFF}");
				            }
				            if(AdminDuty[i] == 1)
					        {
				            	strcat(string, "{FFFFFF} | {F81414}Status: {00FF2F}");
				            }
							strcat(string, "\n");
						}
					}
					if(strlen(string) == 0) return SCM(playerid, -1, "Nijedan admin nije trenutno online.");
					ShowPlayerDialog(playerid, DIALOG_ONLINE_ADMINI, DIALOG_STYLE_MSGBOX, "{F81414}Online admini:", string, "Zatvori", "");
			}
		}
	}
}
Extremac is offline   Reply With Quote
Old 30/05/2020, 10:39 PM   #5
Runn3R
Huge Clucker
 
Runn3R's Avatar
 
Join Date: Dec 2013
Location: Croatia, Split
Posts: 420
Reputation: 36
Default Re: A few small problems, urgent!

Use == to check if the value is equal to 1 for the motel and the other one.

As for the admin list, I can't even figure out what are you trying to do.
Runn3R is offline   Reply With Quote
Old 31/05/2020, 07:38 PM   #6
Extremac
Big Clucker
 
Join Date: Sep 2018
Posts: 48
Reputation: 0
Default Re: A few small problems, urgent!

As for the admin list, I want that when the player types / admins a dialog opens and it is written to him whether he chooses to see the list of all admins or the list of online admins. And when a player selects, for example, a list of all admins, a new dialog will appear where he is shown a list of all admins. But when I select anything, nothing simply happens. Here is the code again:
COMMAND:
Quote:
YCMD:admini(playerid,params[],help)
{
ShowPlayerDialog(playerid, DIALOG_ADMINLIST, DIALOG_STYLE_LIST, "{FFFFFF}Liste Admina:", "{F81414}[1]\t{FFFFFF}Lista Online Admina\n{F81414}[2]\t{FFFFFF}Lista Svih Admina", "Odabir","Odustani");
}
Quote:
if(dialogid == DIALOG_ADMINLIST && response)
{
//if(!response) { return 1; }
switch(listitem)
{
case 0:
{
new str1[512], str2[2048];
for(new i = 1; i < MAX_ADMINS; i++)
{
if(!strcmp(AdminInfo[i][aAdmin], "Niko", false))
{
format(str1, sizeof(str1), "{FFFFFF}S-%d: %s ", i, AdminInfo[i][aAdmin]);
strcat(str2, str1);
strcat(str2, "\n");
}
else
{
format(str1, sizeof(str1), "{FFFFFF}S-%d: %s | Level: %d | Neaktivnost: %d h", i, AdminInfo[i][aAdmin],AdminInfo[i][aRank],AdminInfo[i][aNeaktivnost]);
strcat(str2, str1);
strcat(str2, "\n");
}
}
ShowPlayerDialog(playerid, DIALOG_SVIADMINI, DIALOG_STYLE_MSGBOX, ""CRVENA"Lista Svih Admina", str2, "Zatvori", "");
}
case 1:
{
new string[1024];
format(string, sizeof(string), "");
foreach(Player, i)
{
if (PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 6)
{
new atext[20];
strcat(string, "{F81414}");
strcat(string, GetName(i));
strcat(string, "{FFFFFF} | ");
strcat(string, "{F81414}Admin nivo: {FFFFFF}");
format(atext, sizeof(atext), "%d", PlayerInfo[i][pAdmin]);
strcat(string, atext);
if(AdminDuty[i] == 0)
{
strcat(string, "{FFFFFF} | {F81414}Status: {FFFFFF}•");
}
if(AdminDuty[i] == 1)
{
strcat(string, "{FFFFFF} | {F81414}Status: {00FF2F}•");
}
strcat(string, "\n");
}
}
if(strlen(string) == 0) return SCM(playerid, -1, "Nijedan admin nije trenutno online.");
ShowPlayerDialog(playerid, DIALOG_ONLINE_ADMINI, DIALOG_STYLE_MSGBOX, "{F81414}Online admini:", string, "Zatvori", "");
}
}
}
}
Unfortunately, I don't think it's about the statements, it's about something else because I removed the statements, but again there will be no dialogue, here's how I made it, but again it won't.
Quote:
if(dialogid == DIALOG_SPAWN)
{
if(!response) return 1;
switch(listitem)
{
case 0:
{
PlayerInfo[playerid][pSpawn] = SPAWN_MOTELC;
SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu Centru u BG");
SavePlayer(playerid);
}
case 1:
{
PlayerInfo[playerid][pSpawn] = SPAWN_MOTELJEFF;
SendClientMessage(playerid,-1,"Od sada cete se spawnovati u Motelu JEFF u BG");
SavePlayer(playerid);
}
}
}
}
Extremac is offline   Reply With Quote
Old 02/06/2020, 04:08 PM   #7
Extremac
Big Clucker
 
Join Date: Sep 2018
Posts: 48
Reputation: 0
Default Re: A few small problems, urgent!

Any help? Pleasee
BUMP!
Extremac is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dialog problems[Please urgent help] Dziugsas Scripting Help 0 15/11/2014 03:15 PM
Small Problems :s AnonScripter Scripting Help 2 12/09/2013 04:09 PM
Lots of problems in my commands! Please help (Urgent) Goldino Scripting Help 8 01/02/2013 10:44 PM
Small problems ba200101 Help Archive 1 24/12/2010 05:23 AM
Two Small Problems Alec24 Help Archive 12 09/04/2009 08:25 PM


All times are GMT. The time now is 01:14 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.