Hello, i compile my gm and all ist fine, but in game when type /roadblock 1 not create, it's show me again and again "/roadblock [1-20]"
PHP код:
CMD:roadblock(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a cop!");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can`t place a RoadBlock when you are in a vehicle!");
if(!strlen(x_nr))
{
SCM(playerid,-1,"/roadblock [1-20]");
return 1;
}
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
if(strcmp(x_nr,"1",true) == 0)
{
if(!RoadBlock1[playerid])
{
RoadBlock1[playerid]=true;
RB1[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"2",true) == 0)
{
if(!RoadBlock2[playerid])
{
RoadBlock2[playerid]=true;
RB2[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"3",true) == 0)
{
if(!RoadBlock3[playerid])
{
RoadBlock3[playerid]=true;
RB3[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"4",true) == 0)
{
if(!RoadBlock4[playerid])
{
RoadBlock4[playerid]=true;
RB4[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"5",true) == 0)
{
if(!RoadBlock5[playerid])
{
RoadBlock5[playerid]=true;
RB5[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"6",true) == 0)
{
if(!RoadBlock6[playerid])
{
RoadBlock6[playerid]=true;
RB6[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"7",true) == 0)
{
if(!RoadBlock7[playerid])
{
RoadBlock7[playerid]=true;
RB7[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"8",true) == 0)
{
if(!RoadBlock8[playerid])
{
RoadBlock8[playerid]=true;
RB8[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"9",true) == 0)
{
if(!RoadBlock9[playerid])
{
RoadBlock9[playerid]=true;
RB9[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"10",true) == 0)
{
if(!RoadBlock10[playerid])
{
RoadBlock10[playerid]=true;
RB10[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"11",true) == 0)
{
if(!RoadBlock11[playerid])
{
RoadBlock11[playerid]=true;
RB11[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"12",true) == 0)
{
if(!RoadBlock12[playerid])
{
RoadBlock12[playerid]=true;
RB12[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"13",true) == 0)
{
if(!RoadBlock13[playerid])
{
RoadBlock13[playerid]=true;
RB13[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"14",true) == 0)
{
if(!RoadBlock14[playerid])
{
RoadBlock14[playerid]=true;
RB14[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"15",true) == 0)
{
if(!RoadBlock15[playerid])
{
RoadBlock15[playerid]=true;
RB15[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"16",true) == 0)
{
if(!RoadBlock16[playerid])
{
RoadBlock16[playerid]=true;
RB16[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"17",true) == 0)
{
if(!RoadBlock17[playerid])
{
RoadBlock17[playerid]=true;
RB17[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"18",true) == 0)
{
if(!RoadBlock18[playerid])
{
RoadBlock18[playerid]=true;
RB18[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"19",true) == 0)
{
if(!RoadBlock19[playerid])
{
RoadBlock19[playerid]=true;
RB19[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else if(strcmp(x_nr,"20",true) == 0)
{
if(!RoadBlock20[playerid])
{
RoadBlock20[playerid]=true;
RB20[playerid] = CreateObject(979, X, Y, Z, 0.0, 0.0, A);
}
else return SendClientMessage(playerid, COLOR_GREY, "Road block already created on this slot");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* Invalid roadblock number !");
return 1;
}
SetPlayerPos(playerid, X, Y, Z+2);
GameTextForPlayer(playerid, "~w~Roadblock ~r~Placed", 5000, 5);
}
return 1;
}
Your x_nr is empty, you don't copy there anything from params. Also please do not ever use variable names such as RB1, RB2, RB3, that's what arrays are for! (and your code would be 20 times shorter)
Although, if you use this, you'll need to alter any commands related to roadblocks. Especially your roadblock removal command.