Color HELP
#1

Hello scripters. I get some problems with transfering this command from zcmd to strcmp.

Quote:

CMD:carcolour(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not driving a vehicle.");
new color1, color2;
new vehicleid = GetPlayerVehicleID(playerid);
if(sscanf(params, "hh", color1, color2)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /carcolour [colour1] [colour2]");
ChangeVehicleColor(vehicleid, color1, color2);
return 1;
}

I will be glad if anyone try.
Reply
#2

Good joke.
Reply
#3

What? im back in the community from one year and i forgot everything i think, so don't judge me please.
Reply
#4

Any help?
Reply
#5

Stay with ZCMD, STRCMP is old and slow.
Reply
#6

My whole script is STRCMP, and i know only the STRCMP language ( the style to script ) so i need the command in STRCMP.
Reply
#7

Yet you can not transfer it to strcmp...

You will need this: https://sampwiki.blast.hk/wiki/Strtok
Just add it and do as I do.

Should work, not sure, it is not tested.
PHP код:
if(strcmp(cmd"/carcolour"true) == 0)
{
if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_RED"ERROR: You are not driving a vehicle.");
new 
color1[128], color2[128], idx;
new 
vehicleid GetPlayerVehicleID(playerid);
color1 strtok(cmdtextidx);
color2 strtok(cmdtextidx);
if(
strlen(color1) == || strlen(color2) == 0) return SendClientMessage(playerid0xD9D9D9FF"USAGE: /carcolour [color 1] [color 2]");
ChangeVehicleColor(vehicleidcolor1color2);
return 
1;

Reply
#8

Quote:
Originally Posted by necrobg3
Посмотреть сообщение
My whole script is STRCMP, and i know only the STRCMP language ( the style to script ) so i need the command in STRCMP.
Ye, because
pawn Код:
if(strcmp("/carcolour", cmdtext, true) == 0)
Is a lot easier to write than
pawn Код:
CMD:carcolour(playerid, params[])
[/sarcasm]
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ye, because
pawn Код:
if(strcmp("/carcolour", cmdtext, true) == 0)
Is alot easier to write than
pawn Код:
CMD:carcolour(playerid, params[])
[/sarcasm]
And I made a small mistake. fixed it anyway.
Reply
#10

Quote:
Originally Posted by necrobg3
Посмотреть сообщение
My whole script is STRCMP, and i know only the STRCMP language ( the style to script ) so i need the command in STRCMP.
So why don't you take the time to learn ZCMD?

You would rather accept the fact you are using terrible coding practices than take 5 minutes of your day to save you much time later on along performance? Nice!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)