Hallo,
Wie kann ich machen das zb. Nur das lspd das Tor öffnen kann-
Bitte mit Beispiel.
Mfg
Hallo,
Wie kann ich machen das zb. Nur das lspd das Tor öffnen kann-
Bitte mit Beispiel.
Mfg
wie speicherst du was ab? mit einem Enum wenn ja zeig mal
naja hab ihr ma geschrieben fals du es mit enum machst :
pLeader,
pMember// ins Enum rein
//hir der befehl wie z.b. Makeleader:
ocmd:makeleader(playerid, params) {
if(IsPlayerAdmin(playerid)) {
new pID;
if(sscanf(params,"d",pID)) return SendClientMessage(playerid,Gelb,"[Benutze]: /makeleader [PlayerName/ID]");
PlayerInfo[playerid][pLeader] = 1;
PlayerInfo[playerid][pMember] = 1;
}
else {
SendClientMessage(playerid,0xFF3200FF,"Du bist nich als Rcon eingeloggt!");
}
return 1;
}
//Und du fragst wie folgt ab:
//z.b.
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1){
}
stock sscanf(sstring[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(sstring))
#else
if (sstring[0] == 0 || (sstring[0] == 1 && sstring[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
sstringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (sstring[sstringPos] && sstring[sstringPos] <= ' ')
{
sstringPos++;
}
while (paramPos < paramCount && sstring[sstringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = sstring[sstringPos];
if (ch == '-')
{
neg = -1;
ch = sstring[++sstringPos];
}
do
{
sstringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = sstring[sstringPos];
do
{
sstringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = sstring[sstringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, sstring[sstringPos++]);
}
case 'f':
{
new changestr[16], changepos = 0, strpos = sstringPos;
while(changepos < 16 && sstring[strpos] && sstring[strpos] != delim)
{
changestr[changepos++] = sstring[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(sstring, format[formatPos], false, sstringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
sstringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = sstringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = sstring[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
sstring[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - sstringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, sstring[sstringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
sstring[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
sstringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = sstring[sstringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = sstring[sstringPos++]))
{
setarg(paramPos, i++, ch);
}
}
sstringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (sstring[sstringPos] && sstring[sstringPos] != delim && sstring[sstringPos] > ' ')
{
sstringPos++;
}
while (sstring[sstringPos] && (sstring[sstringPos] == delim || sstring[sstringPos] <= ' '))
{
sstringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
So hätte ich des gemacht, musst nur IsPlayerInFrac (der Stock) anpassen auf deine Speicherung
new pd1, pd1pos;
//Bei OnGamemodeInit
SetTimer(
pd1 = CreateObject(3055, 1588.53, -1637.81, 14.49, 0.00, 0.00, 1.20);
//Befehl um das Tor zu öffnen
if(strcmp(cmdtext,"/pd",true)==0)
{
if(IsPlayerInFrac(playerid,1))
{
if(IsPlayerInRangeOfPoint(playerid,10,1539.8915,-1628.7728,13.4888))
{
if(pd1pos == 0)
{
MoveObject(pd1,1539.50, -1627.70, 4.70,3);
SendClientMessage(playerid,Rot,"Du hast das Hoftor geöffnet");
pd1pos = 1;
SetTimer("pddtor",5000,0);
}
else
{
SendClientMessage(playerid,Rot,"Das Hoftor ist schon offen!");
}
return 1;
}
}
}
//Stock der abfragt, ob Spieler in der Fraktion ist
stock IsPlayerInFrac(playerid,fracid)
{
if (Spieler[playerid][member] == fracid || Spieler[playerid][leader] == fracid)
return 1;
return 0;
}
//Timer um Tor zu schliessen
public pddtor()
{
if(pd1pos >=1)
{
MoveObject(pd1, 227.57, 148.52, 1002.94, 2);
pd1pos = 0;
}
}