08.08.2012, 12:23
I have encountered a bug in my script, in which I cannot seem to come across the solution. It may be simple, but I haven't slept for 24 hours, basically when I type these two commands, it returns as "SERVER: Unknown Command"
Everything else works perfectly. If I am correct, this is only happening with my commands either using sscanf or isnull.
pawn Код:
CMD:me(playerid, params[]) // BUGGED
{
new
string[128],
action[100];
if(sscanf(params, "s[100]", action))
{
SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/me [action]");
return 1;
}
else
{
format(string, sizeof(string), "* %s %s.",(playerid), action);
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
return 1;
}
CMD:act(playerid, params[]) // BUGGED
{
new
string[128],
action[100];
if(sscanf(params, "s[100]", action))
{
SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/act [action]");
return 1;
}
else
{
format(string, sizeof(string), "* %s %s.",(playerid), action);
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
return 1;
}
CMD:pm(playerid,params[]) // BUGGED
{
new message[128];
if(sscanf(params, "us[32]", playerid, message))
{
return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: {FFFFFF}/pm <playerid> <message>");
}
if(!IsPlayerConnected(playerid))
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
new pmsg[256];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
format(pmsg,sizeof(pmsg),"PM from %s(%d): %s",Name,playerid,message);
new playeridmsg[256];
new playeridname[MAX_PLAYER_NAME];
GetPlayerName(playerid,playeridname,sizeof(playeridname));
format(playeridmsg,sizeof(playeridmsg),"PM to %s(%d): %s",playeridname,playerid,message);
SendClientMessage(playerid, COLOR_YELLOW, pmsg);
SendClientMessage(playerid, COLOR_YELLOW, playeridmsg);
return 1;
}
CMD:car(playerid,params[]) // BUGGED
{
new string[128],idx;
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid,-1, "USAGE: {FFFFFF}[vehicleid] [color1] [color2]");
return 1;
}
new car = strval(string);
if(car < 400 || car > 611)
{
SendClientMessage(playerid, -1, " VehicleID: 400-611"); return 1;
}
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/car [Vehicle] [color1] [color2]");
return 1;
}
new color1 = strval(string);
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/car [Vehicle] [color1] [color2]");
return 1;
}
new color2 = strval(string);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new v = CreateVehicle(car, X+2,Y,Z, 0.0,color1,color2, -1);
LinkVehicleToInterior(v,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(v,GetPlayerVirtualWorld(playerid));
SendClientMessage(playerid, -1, "have fun!");
return 1;
}
CMD:weapons(playerid, params[]) // BUGGED
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: {FFFFFF}/weapons [weapon name]");
if(!strcmp(params,"knuckles",true))
{
GivePlayerWeapon(playerid, 1, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself brass knuckles.");
}
else if(!strcmp(params,"golfclub",true))
{
GivePlayerWeapon(playerid, 2, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself brass knuckles.");
}
else if(!strcmp(params,"nitestick",true))
{
GivePlayerWeapon(playerid, 3, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a nitestick.");
}
else if(!strcmp(params,"knife",true))
{
GivePlayerWeapon(playerid, 4, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a knife.");
}
else if(!strcmp(params,"bat",true))
{
GivePlayerWeapon(playerid, 5, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a baseball bat.");
}
else if(!strcmp(params,"shovel",true))
{
GivePlayerWeapon(playerid, 6, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a shovel.");
}
else if(!strcmp(params,"poolcue",true))
{
GivePlayerWeapon(playerid, 7, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a pool cue.");
}
else if(!strcmp(params,"katana",true))
{
GivePlayerWeapon(playerid, 8, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a katana.");
}
else if(!strcmp(params,"chainsaw",true))
{
GivePlayerWeapon(playerid, 9, 1);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a chainsaw.");
}
else if(!strcmp(params,"grenade",true))
{
GivePlayerWeapon(playerid, 16, 50);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself 50 grenades.");
}
else if(!strcmp(params,"molotov",true))
{
GivePlayerWeapon(playerid, 18, 50);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself 50 molotovs.");
}
else if(!strcmp(params,"colt",true))
{
GivePlayerWeapon(playerid, 22, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a Colt 45.");
}
else if(!strcmp(params,"silencer",true))
{
GivePlayerWeapon(playerid, 23, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a silenced pistol.");
}
else if(!strcmp(params,"deagle",true))
{
GivePlayerWeapon(playerid, 24, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a desert eagle.");
}
else if(!strcmp(params,"shotgun",true))
{
GivePlayerWeapon(playerid, 25, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a shotgun.");
}
else if(!strcmp(params,"sawnoff",true))
{
GivePlayerWeapon(playerid, 26, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a sawnoff shotgun.");
}
else if(!strcmp(params,"combat",true))
{
GivePlayerWeapon(playerid, 27, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a combat shotgun.");
}
else if(!strcmp(params,"uzi",true))
{
GivePlayerWeapon(playerid, 28, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a mini uzi.");
}
else if(!strcmp(params,"mp5",true))
{
GivePlayerWeapon(playerid, 29, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself an MP5.");
}
else if(!strcmp(params,"ak47",true))
{
GivePlayerWeapon(playerid, 30, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a Colt 45.");
}
else if(!strcmp(params,"m4",true))
{
GivePlayerWeapon(playerid, 31, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself an M4.");
}
else if(!strcmp(params,"tec9",true))
{
GivePlayerWeapon(playerid, 32, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a Tec-9.");
}
else if(!strcmp(params,"rifle",true))
{
GivePlayerWeapon(playerid, 33, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a country rifle.");
}
else if(!strcmp(params,"sniper",true))
{
GivePlayerWeapon(playerid, 34, 9999);
SendClientMessage(playerid,COLOR_GREY,"SERVER: You have just gave yourself a sniper.");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Incorrect weapon name, please try again!");
}
return 1;
}