2 bugs in admin script help please
#1

I am admin level 3 and telling me i am not allowed to use that command.. :S
pawn Код:
dcmd_slap(playerid, params[])
{
    new slapid;
    new string[128];
    new reason[128];

    if(UserUD[playerid][admin] < 1 || UserUD[playerid][vip] < 1) return SendClientMessage(playerid,green,"Error: You are not authorized to use this command.");
    if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,green,"Error: /slap ID/Name Reason");
    if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid)return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself");

    format(string,sizeof(string),"Error: %s(id: %d) has slapped %s(id: %d) Reason: %s",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason);
    SendClientMessageToAll(green,string);

    new Float:x,
        Float:y,
        Float:z;
    GetPlayerPos(slapid, x,y,z);
    SetPlayerPos(slapid, x, y, z+8);
    PlayerPlaySound(slapid, 1190, 0,0,0);
    return 1;
}
-------------------------
Here it doesn't send the message to all players.. :S
pawn Код:
new string[128];
  new IP[16];
  for(new i=0; i<MAX_PLAYERS; i++)
    if(UserUD[i][admin] < 1)
    {
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
    SendClientMessage(i,red, string);
    }
    else if(UserUD[i][admin] == 0)
    {
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
    SendClientMessage(i,red, string);
  }
Reply
#2

pawn Код:
dcmd_slap(playerid, params[])
{
    new slapid;
    new string[128];
    new reason[128];

    if(UserUD[playerid][admin] < 1 || UserUD[playerid][vip] < 1) return SendClientMessage(playerid,green,"Error: You are not authorized to use this command.");
}
else
{
    if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,green,"Error: /slap ID/Name Reason");
    if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid)return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself");

    format(string,sizeof(string),"Error: %s(id: %d) has slapped %s(id: %d) Reason: %s",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason);
    SendClientMessageToAll(green,string);

    new Float:x,
        Float:y,
        Float:z;
    GetPlayerPos(slapid, x,y,z);
    SetPlayerPos(slapid, x, y, z+8);
    PlayerPlaySound(slapid, 1190, 0,0,0);
}
    return 1;
}
pawn Код:
new string[128];
  new IP[16];
  for(new i=0; i<MAX_PLAYERS; i++)
    if(UserUD[i][admin] < 1)
    {
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
    SendClientMessageToAll(red, string);
    }
    else if(UserUD[i][admin] == 0)
    {
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
    SendClientMessageToAll(red, string);
  }
Reply
#3

This should do it;

pawn Код:
dcmd_slap(playerid, params[])
{
new slapid;
new string[128];
new reason[128];

if(UserUD[playerid][admin] < 1 || UserUD[playerid][vip] < 1) return SendClientMessage(playerid,green,"Error: You are not authorized to use this command.");
}
else
{
if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,green,"Error: /slap ID/Name Reason");
    if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid)return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself");

format(string,sizeof(string),"Error: %s(id: %d) has slapped %s(id: %d) Reason: %s",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason);
SendClientMessageToAll(green,string);

new Float:x,
Float:y,
Float:z;
GetPlayerPos(slapid, x,y,z);
SetPlayerPos(slapid, x, y, z+8);
PlayerPlaySound(slapid, 1190, 0,0,0);
}
return 1;
}
As for this, you have to be a noob not to fix!!!;

pawn Код:
new string[128];
  new IP[16];
  for(new i=0; i<MAX_PLAYERS; i++)
if(UserUD[i][admin] < 1)
{
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
SendClientMessageToAll(red, string);
}
else if(UserUD[i][admin] == 0)
{
GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
SendClientMessageToAll(red, string);
  }
Reply
#4

Quote:
Originally Posted by RealCop228™
This should do it;

pawn Код:
dcmd_slap(playerid, params[])
{
new slapid;
new string[128];
new reason[128];

if(UserUD[playerid][admin] < 3 || UserUD[playerid][vip] < 1) return SendClientMessage(playerid,green,"Error: You are not authorized to use this command.");
}
else
{
if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,green,"Error: /slap ID/Name Reason");
    if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid)return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself");

format(string,sizeof(string),"Error: %s(id: %d) has slapped %s(id: %d) Reason: %s",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason);
SendClientMessageToAll(green,string);

new Float:x,
Float:y,
Float:z;
GetPlayerPos(slapid, x,y,z);
SetPlayerPos(slapid, x, y, z+8);
PlayerPlaySound(slapid, 1190, 0,0,0);
return 1;
}
As for this, you have to be a noob not to fix!!!;

pawn Код:
new string[128];
  new IP[16];
  for(new i=0; i<MAX_PLAYERS; i++)
if(UserUD[i][admin] < 1)
{
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
SendClientMessage(i,red, string);
}
else if(UserUD[i][admin] == 0)
{
GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
SendClientMessageToAll(i,red, string);
  }
Didn't I do the same?
And your code fails, you missed a brace.
Reply
#5

Ah, your right! Fixed!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)