CMD Disable -
weedxd - 18.09.2014
Well the timer is working but i dunno how to disable the command till the timer runs out. ;/
PHP код:
CMD:dropcar(playerid, params[])
{
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command.");
else if(dropping[playerid] == false)
{
format(string, sizeof(string), "You need to wait {FF6347}%d{33CCFF} more seconds before doing dropcar again.", DropTime[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if(GetPlayerVehicleID(playerid) != 0)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!");
dropping[playerid] = true;
}
return 1;
}
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(dropping[playerid] == true)
{
DisablePlayerCheckpoint(playerid);
new vehicleid = GetPlayerVehicleID(playerid);
new string[128], playerb, amount;
amount = random (100);
format(string, sizeof(string), "*You've earned {FF6347}$%d{33CCFF} from dropping a car!", amount);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GiveDodMoney(playerb, amount);
SetVehicleToRespawn(vehicleid);
dropping[playerid] = false;
DropTime[playerid] = 60*20;
SetTimerEx("DropcarTime", 1000, false, "i", playerid);
Re: CMD Disable -
Eth - 18.09.2014
pawn Код:
CMD:dropcar(playerid, params[])
{
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command.");
if(dropping[playerid] == false) return format(string, sizeof(string), "You need to wait {FF6347}%d{33CCF}more seconds before doing dropcar again.", DropTime[playerid]),SendClientMessage(playerid, COLOR_GREY, string);
if(GetPlayerVehicleID(playerid) != 0)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!");
dropping[playerid] = true;
}
return 1;
}
Re: CMD Disable -
Beckett - 18.09.2014
Create a global variable, make it 1, set a timer, when timer ends, set var 0. if var == 1, return.
e.g:
pawn Код:
new g_var[MAX_PLAYERS];
forward CountDown(playerid);
public CountDown(playerid)
{
g_var[playerid] = 0;
}
CMD:dropcar(playerid, params[])
{
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
if(g_var[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY,"You need to wait (INSERT TIME) to use this command again.");
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command.");
if(dropping[playerid] == false) return format(string, sizeof(string), "You need to wait {FF6347}%d{33CCF}more seconds before doing dropcar again.", DropTime[playerid]),SendClientMessage(playerid, COLOR_GREY, string);
if(GetPlayerVehicleID(playerid) != 0)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!");
g_var[playerid] = 1;
SetTimerEx("CountDown",TimeYouWant, false, "d", playerid);
}
return 1;
}
Re: CMD Disable -
weedxd - 18.09.2014
Quote:
Originally Posted by DaniceMcHarley
Create a global variable, make it 1, set a timer, when timer ends, set var 0. if var == 1, return.
e.g:
pawn Код:
new g_var[MAX_PLAYERS]; forward CountDown(playerid); public CountDown(playerid) { g_var[playerid] = 0; } CMD:dropcar(playerid, params[]) { new string[128]; new vehicleid = GetPlayerVehicleID(playerid); if(g_var[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY,"You need to wait (INSERT TIME) to use this command again."); if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command."); if(dropping[playerid] == false) return format(string, sizeof(string), "You need to wait {FF6347}%d{33CCF}more seconds before doing dropcar again.", DropTime[playerid]),SendClientMessage(playerid, COLOR_GREY, string); if(GetPlayerVehicleID(playerid) != 0) { DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!"); g_var[playerid] = 1; SetTimerEx("CountDown",TimeYouWant, false, "d", playerid); } return 1; }
|
You want me to just create new variable ?
Re: CMD Disable -
shourya12 - 18.09.2014
Quote:
Originally Posted by weedxd
You want me to just create new variable ?
|
Just Copy-Paste Those codes...
Re: CMD Disable -
weedxd - 18.09.2014
Quote:
Originally Posted by Eth
pawn Код:
CMD:dropcar(playerid, params[]) { new string[128]; new vehicleid = GetPlayerVehicleID(playerid); if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command."); if(dropping[playerid] == false) return format(string, sizeof(string), "You need to wait {FF6347}%d{33CCF}more seconds before doing dropcar again.", DropTime[playerid]),SendClientMessage(playerid, COLOR_GREY, string); if(GetPlayerVehicleID(playerid) != 0) { DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!"); dropping[playerid] = true; } return 1; }
|
Thanks but when im doin /dropcar server shows that i have to wai 0 secs.
Re: CMD Disable -
shourya12 - 18.09.2014
Use Danice's Codes....
Quote:
Originally Posted by DaniceMcHarley
Create a global variable, make it 1, set a timer, when timer ends, set var 0. if var == 1, return.
e.g:
pawn Код:
new g_var[MAX_PLAYERS]; forward CountDown(playerid); public CountDown(playerid) { g_var[playerid] = 0; } CMD:dropcar(playerid, params[]) { new string[128]; new vehicleid = GetPlayerVehicleID(playerid); if(g_var[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY,"You need to wait (INSERT TIME) to use this command again."); if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!vehicleid) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to use this command."); if(dropping[playerid] == false) return format(string, sizeof(string), "You need to wait {FF6347}%d{33CCF}more seconds before doing dropcar again.", DropTime[playerid]),SendClientMessage(playerid, COLOR_GREY, string); if(GetPlayerVehicleID(playerid) != 0) { DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!"); g_var[playerid] = 1; SetTimerEx("CountDown",TimeYouWant, false, "d", playerid); } return 1; }
|
Re: CMD Disable -
weedxd - 18.09.2014
Quote:
Originally Posted by shourya12
Use Danice's Codes....
|
Well i just did still same thing ;/
Re: CMD Disable -
Beckett - 18.09.2014
Because you clearly didn't read my code just copy-pasted it and compiled, right?
Re: CMD Disable -
weedxd - 18.09.2014
I made that variable with =1
But i didnt get the other stuff as im kinda new into scripting ;/
And placed Forwarding under timer section and New on top of script