How to. -
~Dangun! - 17.01.2010
I created /jail but how to make if someone is in the jail he can't use /kill?
pawn Код:
dcmd_funjail(playerid, params[])
{
new jailid;
new reason[128];
new string[128];
if(pInfo[playerid][level] < 3) return SendClientMessage(playerid,ADMIN,"Error: You aren't level 3 admin or higher! ");
if(sscanf(params, "uz", jailid, reason)) return SendClientMessage(playerid,ADMIN,"USAGE: /jail <playerid/name> <reason>");
format(string,sizeof(string),"[ADMIN] %s has FunJailed %s Reason: Let's Gamble Bitch!",pInfo[playerid][name],pInfo[jailid][name]);
SendClientMessageToAll(GAME_ENGINE,string);
SetPlayerInterior(jailid, 1);
SetPlayerPos(jailid, 2233.8032, 1712.2303, 1011.7632);
return 1;
}
pawn Код:
dcmd_kill(playerid, params[])
{
#pragma unused params
SetPlayerHealth(playerid,0);
return 1;
}
Re: How to. -
Nero_3D - 17.01.2010
you need to use a variable which marks the playerid as jailed
Example (one of the most known)
pawn Код:
new bool:IsLogged[MAX_PLAYERS]; //a variable marked with the boolean tag can only store false or true
//if nothing is assigned to the variable, it is 0 or false
pawn Код:
dcmd_login(playerid, password[])
{
if("password is correct")
{
IsLogged[playerid] = true; //sets the variable to true
}
}
pawn Код:
dcmd_help(playerid, unused[])
{
#pragma unused unused
if(IsLogged[playerid] == false) //if he isnt logged he gets a the message
return SendClientMessage(playerid, 0xFFFFFFAA, "You arent logged!");
SendClientMessage(playerid, 0xFFFFFFAA, "Help");
return true;
}
This should be understandable
Offtopic
This section is for helping not for (so the person learns something)
Wuf, wuf, catch the code and be happy
Offtopic
Re: How to. -
jamesb93 - 17.01.2010
This should work:
pawn Код:
new Jailed[MAX_PLAYERS];
dcmd_funjail(playerid, params[])
{
new jailid;
new reason[128];
new string[128];
if(pInfo[playerid][level] < 3) return SendClientMessage(playerid,ADMIN,"Error: You aren't level 3 admin or higher! ");
if(sscanf(params, "uz", jailid, reason)) return SendClientMessage(playerid,ADMIN,"USAGE: /jail <playerid/name> <reason>");
format(string,sizeof(string),"[ADMIN] %s has FunJailed %s Reason: Let's Gamble Bitch!",pInfo[playerid][name],pInfo[jailid][name]);
SendClientMessageToAll(GAME_ENGINE,string);
SetPlayerInterior(jailid, 1);
SetPlayerPos(jailid, 2233.8032, 1712.2303, 1011.7632);
Jailed[playerid] = 1;
return 1;
}
pawn Код:
dcmd_funjail(playerid, params[])
{
new jailid;
new reason[128];
new string[128];
if(pInfo[playerid][level] < 3) return SendClientMessage(playerid,ADMIN,"Error: You aren't level 3 admin or higher! ");
if(sscanf(params, "uz", jailid, reason)) return SendClientMessage(playerid,ADMIN,"USAGE: /jail <playerid/name> <reason>");
format(string,sizeof(string),"[ADMIN] %s has FunJailed %s Reason: Let's Gamble Bitch!",pInfo[playerid][name],pInfo[jailid][name]);
SendClientMessageToAll(GAME_ENGINE,string);
SetPlayerInterior(jailid, 1);
SetPlayerPos(jailid, 2233.8032, 1712.2303, 1011.7632);
return 1;
}
PAWN Code:
dcmd_kill(playerid, params[])
{
#pragma unused params
if(Jailed[playerid] ==1)
{
SendClientMessage(playerid, COLOR_RED, "blahh blahh");
return 1;
}
if(Jailed[playerid] == 0)
{
SetPlayerHealth(playerid,0);
return 1;
}
}
Re: How to. -
wiilweer - 17.01.2010
One way
OntheTop
Код:
new jailed[MAX_PLAYERS];
OnPlayerConnect
Код:
jailed[playerid] == 0;
When you jail him
Код:
jailed[playerid] = 1;
And under kill command
Код:
if (jailed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You can't kill yourself in prison");
Dont forget to set value 0 if he is released!