13.12.2009, 01:11
Hello, today I have been working a little bit to learn how to code with DCMD. I got to the point where it didn't make sense to me, since I just started, so this is my code.
Lines 91-126
127 - 162
as you can see, I was working to create a /ban and /kick command, but not have so many errors.
Errors :
As you can see, what I was attempting to do was, When a player tries to kick another player, and that player is not active, it sends the message, and if the player (kicker) is not an admin, and he tries to kick another player, he should get the other message saying he is not the admin with the required level.
Any help would be appreciated.
Hiitch.
P.s. Sorry for the bad indentation, comes when I copy / paste from pawno to here.
Lines 91-126
pawn Код:
dcmd_kick(playerid, const params[])
{
if(IsPlayerAdmin(playerid))
{
new giveplayerid;
if(!strlen(params))
{
SendClientMessage(playerid, 0xFF0000FF, "Invalid Params ! > '/kick ID'");
return 1;
}
giveplayerid = strval(params);
if(IsPlayerConnected(giveplayerid))
{
new string[39];
format(string, sizeof(string), "You have kicked ID %i", playerid);
SendClientMessage(playerid, 0xFF0000FF, string);
format(string, sizeof(string), "An admin has kicked ID %i from the server", playerid);
SendClientMessageToAll(0xFF0000FF, string);
SendClientMessage(playerid, 0xFF0000FF, "You have been kicked from the server!");
kick(giveplayerid);
{
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "[server] Error: Player is not active!");
return 1;
}
{
else
{
SendClientMessage(playerid, 0xFF0000FF, "You are not an admin with the required level!");
return 1;
}
}
}
}
pawn Код:
dcmd_ban(playerid, const params[])
{
if(IsPlayerAdmin(playerid))
{
new giveplayerid;
if(!strlen(params))
{
SendClientMessage(playerid, 0xFF0000FF, "Invalid Params ! > ' /ban ID '");
return 1;
}
giveplayerid = strval(params);
if(IsPlayerConnected(giveplayerid))
{
new string[36];
format(string, sizeof(string), "You have banned ID %i", playerid);
SendClientMessage(playerid, 0xFF0000FF, string);
format(string, sizeof(string), "ID %i has been banned from the server!", playerid);
SendClientMessage(playerid, 0xFF0000FF, string);
SendClientMessage(playerid, 0xFF0000FF, "You have been banned from the server!");
Ban(giveplayerid);
return 1;
{
else
{
SendClientMessage(playerid, 0xFF0000FF, "[server] Error: Player is not active!");
return 1;
}
{
else
{
SendClientMessage(playerid, 0xFF0000FF, "You are not an admin with the required level!");
return 1;
}
}
}
Errors :
Код:
C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(112) : error 029: invalid expression, assumed zero C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(117) : warning 225: unreachable code C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(117) : warning 217: loose indentation C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(118) : error 029: invalid expression, assumed zero C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(127) : warning 217: loose indentation C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(127) : error 017: undefined symbol "dcmd_ban" C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(127) : error 029: invalid expression, assumed zero C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(127) : error 029: invalid expression, assumed zero C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\RolePlayingServerV1.pwn(127) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
Any help would be appreciated.
Hiitch.
P.s. Sorry for the bad indentation, comes when I copy / paste from pawno to here.