CMD:mlift(playerid, params[]) { if (isnull(params)) return SendClientMessage(playerid, -1, Usage: /mlift <up/down>"); if (!strcmp(params, "up", true)) { if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1569.34424, -2156.86060, 12.96720)) return SendClientMessage(playerid, blue, "You Are Not In Garage!"); MoveObject(MechLift, 1569.34424, -2156.86060, 14.70720, 0.5); } else if (!strcmp(params, "down", true)) { if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1569.34424, -2156.86060, 12.96720)) return SendClientMessage(playerid, blue, "You Are Not In Garage!"); MoveObject(MechLift, 1569.34424, -2156.86060, 12.96720, 0.5); } else SendClientMessage(playerid, -1, "usage: up da down!"); return 1; }
if(strcmp(cmd, "/mlift", true) == 0)
{
if (isnull(params)) return SendClientMessage(playerid, -1, Usage: /mlift <up/down>");
if (!strcmp(params, "up", true))
{
if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1569.34424, -2156.86060, 12.96720)) return SendClientMessage(playerid, blue, "You Are Not In Garage!");
MoveObject(MechLift, 1569.34424, -2156.86060, 14.70720, 0.5);
}
else if (!strcmp(params, "down", true))
{
if(!IsPlayerInRangeOfPoint(playerid, 5.0, 1569.34424, -2156.86060, 12.96720)) return SendClientMessage(playerid, blue, "You Are Not In Garage!");
MoveObject(MechLift, 1569.34424, -2156.86060, 12.96720, 0.5);
}
else SendClientMessage(playerid, -1, "usage: up da down!");
return 1;
}
Params are automatically defined when using a ZCMD command. Use strtok:
https://sampwiki.blast.hk/wiki/Strtok Although I recommend using sscanf2 instead: https://sampforum.blast.hk/showthread.php?tid=120356 |