PDA

View Full Version : How let select class if time passed


henkas
18/03/2017, 09:00 PM
How can i let select class if time is passed, for example >210 I can select, <210 i cant select. So if time passed i want make that, you can select class, bat just with one condition you press on it and you get message "Class will be selected on next round", so if i DIE or NEXT MAP started then i get that class. I hope you understand what i mean.

P.S is let you select if time is not passed 210.
case DIALOG_CLASS_2:
{
if(teams[playerid] == TEAM_RED)
{
if(response)
{
if(times >= 210)
{
switch(listitem)
{
case 0: if(pInfo[playerid][pXP] >= 0) pInfo[playerid][pRedClass] = 0,pInfo[playerid][pHumanClass] = CIVILIAN,setClass(playerid); else { SendXPError(playerid,0); }
case 1: if(pInfo[playerid][pXP] >= 1000) pInfo[playerid][pRedClass] = 0,pInfo[playerid][pHumanClass] = POLICEMAN,setClass(playerid); else { SendXPError(playerid,1000); }
case 2: if(pInfo[playerid][pXP] >= 2000) pInfo[playerid][pRedClass] = 0,pInfo[playerid][pHumanClass] = MEDIC,setClass(playerid); else { SendXPError(playerid,2000); }

This is setClass stock

stock setClass(playerid)
{
if(teams[playerid] == TEAM_RED)
{
ResetPlayerWeapons(playerid);
switch(pInfo[playerid][pRedClass])
{
case CIVILIAN:
{
GivePlayerWeapon(playerid,23,50);
GivePlayerWeapon(playerid,25,70);
SetPlayerArmour(playerid,0);
switch(random(6))
{
case 0: SetPlayerSkin(playerid,5);
case 1: SetPlayerSkin(playerid,23);
case 2: SetPlayerSkin(playerid,56);
case 3: SetPlayerSkin(playerid,289);
case 4: SetPlayerSkin(playerid,299);
}
}

case POLICEMAN:
{
GivePlayerWeapon(playerid,24,72);
GivePlayerWeapon(playerid,25,80);
SetPlayerArmour(playerid,0);
SetPlayerSkin(playerid,281);
}

case MEDIC:
{
GivePlayerWeapon(playerid,23,100);
GivePlayerWeapon(playerid,25,110);
SetPlayerArmour(playerid,10);
SetPlayerSkin(playerid,275);
}
}
}

setClass i use in "OnPlayerSpawn"

henkas
19/03/2017, 12:21 AM
Bump

henkas
19/03/2017, 10:02 AM
bump

coool
19/03/2017, 10:54 AM
There is
if(times >= 210)

in the first one change 210 to your desired time. Is that what you want?

Pokemon64
19/03/2017, 10:56 AM
There is

in the first one change 210 to your desired time. Is that what you want?
Read, dude.

henkas
19/03/2017, 10:57 AM
There is

in the first one change 210 to your desired time. Is that what you want?

No. I want make if time passed 210sec class will set only if i die or next round started.

henkas
19/03/2017, 01:36 PM
Bump

henkas
19/03/2017, 05:28 PM
Any ideas?

henkas
24/03/2017, 09:13 PM
Bump

jasperschellekens
25/03/2017, 10:23 AM
Create a timer?

henkas
25/03/2017, 10:43 AM
Create a timer?
Why do we even need timer for this? I think you didn't saw code.

jasperschellekens
25/03/2017, 11:54 AM
Why do we even need timer for this? I think you didn't saw code.

So tell me then, how will you change the class after a certain amount of time?

henkas
25/03/2017, 04:37 PM
So tell me then, how will you change the class after a certain amount of time?
Look if time passed 210, why this function will not work. So why we need other timer? Explain me.
if(times >= 210)
{

jasperschellekens
25/03/2017, 04:42 PM
if(gettime() - Temp[playerid] > 210)
{
// do stuff here
}

Temp[playerid] = gettime(); // used to get the time


I prefer using a different kind of timer tho... I dont know if it will even work.

Toroi
25/03/2017, 04:46 PM
The simplest way to make this is using the gettime() + your time function in a player variable.

When they respawn, check if their player variable is equal or higher than the actual gettime() function, if so, make them respawn with the same class, if not, set it and proceed with the class selection.

I'll structure what I said above so you can get an idea


When they respawn
{
check if their player variable is equal or higher than the actual gettime() function
{
if so, make them respawn with the same class
}
if not
{
set it (the player variable to gettime() + your desired time) and proceed with the class selection.
}
}


EDIT: Didn't notice the previous post. I was typing this in the meantime that was posted.

henkas
15/04/2017, 08:48 PM
The simplest way to make this is using the gettime() + your time function in a player variable.

When they respawn, check if their player variable is equal or higher than the actual gettime() function, if so, make them respawn with the same class, if not, set it and proceed with the class selection.

I'll structure what I said above so you can get an idea


When they respawn
{
check if their player variable is equal or higher than the actual gettime() function
{
if so, make them respawn with the same class
}
if not
{
set it (the player variable to gettime() + your desired time) and proceed with the class selection.
}
}


EDIT: Didn't notice the previous post. I was typing this in the meantime that was posted.

Sorry i don't really understand it quote

henkas
16/04/2017, 10:03 AM
bump

henkas
17/04/2017, 02:45 PM
bump

henkas
18/04/2017, 08:58 AM
bump

Spoookymon
18/04/2017, 12:36 PM
Amm, how about timer and global var !?...

henkas
19/04/2017, 09:47 AM
Amm, how about timer and global var !?...
Explain it better.

henkas
20/04/2017, 10:03 AM
bump

henkas
23/04/2017, 10:32 AM
bump

henkas
29/04/2017, 09:12 AM
Bump

henkas
30/04/2017, 09:27 AM
Bump

henkas
02/05/2017, 01:47 PM
Bump