Hallo.
Ich hab eine problem.
ich habe hier ein support system gescriptet.
aber ich hab es getestet wenn man /support text macht,sieht man den text ,wo eigendlich nur die supporter sehen sollten.
Wie mache ich,dass er nur /support machen kann?
und dann der supporter macht ja dann /as (answer support)
Hier der Code:
Code
if(strcmp(cmd, "/support", true) ==0 || strcmp(cmd, "/sup", true) == 0) //db
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
return 1;
}
if ((nonewbie) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " The Support channel has been disabled by an admin!");
return 1;
}
if(PlayerInfo[playerid][pNMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You are muted from the Support chat, Can't speak.");
return 1;
}
new str[160];
GetPlayerName(playerid, str, MAX_PLAYER_NAME);
for (new i = 0; i < MAX_PLAYER_NAME; i++)
if (str[i] == '_')
str[i] = ' ';
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /support [text]");
return 1;
}
format(str, sizeof(str), "*(( Support: %s[%i]: %s ))", str, playerid, result);
SendClientMessageToAll(COLOR_GREEN, "** To answer this player, /as [ID] [Answer]");
for (new n=0; n<MAX_PLAYERS; n++)
{
if (IsPlayerConnected(n))
{
SendClientMessage(n, COLOR_ORANGE, str);
}
}
printf("%s", str);
}
return 1;
Alles anzeigen
Code 2 :
Code
if(strcmp(cmd, "/as", true) == 0 || strcmp(cmd, "/answersupport", true) == 0) //db
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)nswer(s)upport [playerid/PartOfName] [message text]");
return 1;
}
if(!IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid,COLOR_RED,"Du bist kein Admin!");
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " That player is blocking Support Answers !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "* %s mutters somthing.", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)nswer(s)upport [playerid/PartOfName] [message text]");
return 1;
}
format(string, sizeof(string), "(( Support: %s ))",result);
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
format(string, sizeof(string), "Support sent to %s(ID: %d): Support: &s ", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_ORANGE, string);
// PMLog(string[]);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(BigEarW[i])
{
format(string, sizeof(string), "(( Support: %s ))",result);
SendClientMessage(i, COLOR_GREEN, string);
}
}
SBizzInfo[2][sbTill] += txtcost / 2;
ExtortionSBiz(2, txtcost / 2);
return 1;
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
Alles anzeigen
hoffe ihr könnt mir helfen.