convert zcmd to strcmp please
#1

hi guys can anybody convert zcmd to strcmp please ?

Thanks.


Код:
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;
}
Reply
#2

Why would you want to convert that to strcmp?
zcmd is much faster.
Reply
#3

coz my server gm using strcmp so.. please convert it if you can

it ll not work together.
Reply
#4

This is like stepping on the brakes and throwing your car in reverse on the highway completely senseless.
Reply
#5

can anybody do that ?!
Reply
#6

You could change all commands to ZCMD , it is much faster -
https://sampforum.blast.hk/showthread.php?tid=271043
Reply
#7

I'd recommend converting your gamemode to ZCMD. ZCMD is much more faster then STRCMP, how-ever here it is,

pawn Код:
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;
}
NOTE: You'll need to include the "isnull" function if you don't have it already as it's included with ZCMD.
Reply
#8

ty but now i have this

error 017: undefined symbol "params"

i must define "params" ?
Reply
#9

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
Reply
#10

Quote:
Originally Posted by Mionee
Посмотреть сообщение
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
can you give me already maked code ? sorry for my english
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)