public OnPlayerCommandText(playerid, cmdtext[])
{
return 1;
}
What the, and what should just a return 1; do ??
You should make a command... |
Put return 0 at the end of the OnPlayerCommandText and return 1 at the end of the command.
|
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/carcolour", cmd, true) == 0)
{
new Colour1[128];
new Colour2[128];
new currentveh;
Colour1 = strtok(cmdtext, idx);
Colour2 = strrest(cmdtext, idx);
currentveh = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a car.");
if(IsPlayerInAnyVehicle(playerid))
{
if (!strval(Colour1) || strval(Colour1)> 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour1.");
return 1;
}
else if (!strval(Colour2) || strval(Colour2) > 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour2.");
return 1;
}
else {
ChangeVehicleColor(currentveh, strval(Colour1), strval(Colour2));
}
}
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/carcolour", cmd, true) == 0)
{
new Colour1[128];
new Colour2[128];
new currentveh;
Colour1 = strtok(cmdtext, idx);
Colour2 = strrest(cmdtext, idx);
currentveh = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a car.");
if(IsPlayerInAnyVehicle(playerid))
{
if (!strval(Colour1) || strval(Colour1)> 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour1.");
return 1;
}
else if (!strval(Colour2) || strval(Colour2) > 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour2.");
return 1;
}
else
{
ChangeVehicleColor(currentveh, strval(Colour1), strval(Colour2));
}
}
return 1;
}
return 0;
}
This is my car colour command:
+ When player in a car and tape /carcolour it well give to him USAGE: /carcolour id1 id2 because now, if I tape /carcolour it give me Invalid ID1 ?! and /carcolour 158 it give me Invalid ID2?! |