Color HELP - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Color HELP (
/showthread.php?tid=419187)
Color HELP -
necrobg3 - 27.02.2013
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.
Re: Color HELP -
Vince - 27.02.2013
Good joke.
Re: Color HELP -
necrobg3 - 27.02.2013
What? im back in the community from one year and i forgot everything i think, so don't judge me please.
Re: Color HELP -
necrobg3 - 28.02.2013
Any help?
Re: Color HELP -
Luis- - 28.02.2013
Stay with ZCMD, STRCMP is old and slow.
Re: Color HELP -
necrobg3 - 28.02.2013
My whole script is STRCMP, and i know only the STRCMP language ( the style to script ) so i need the command in STRCMP.
Re: Color HELP -
Denying - 01.03.2013
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(playerid, COLOR_RED, "ERROR: You are not driving a vehicle.");
new color1[128], color2[128], idx;
new vehicleid = GetPlayerVehicleID(playerid);
color1 = strtok(cmdtext, idx);
color2 = strtok(cmdtext, idx);
if(strlen(color1) == 0 || strlen(color2) == 0) return SendClientMessage(playerid, 0xD9D9D9FF, "USAGE: /carcolour [color 1] [color 2]");
ChangeVehicleColor(vehicleid, color1, color2);
return 1;
}
Re: Color HELP -
Vince - 01.03.2013
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]
Re: Color HELP -
Denying - 01.03.2013
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.
Re: Color HELP -
Bakr - 01.03.2013
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!