Convert ZCMD to strcmd
#1

how can i convert this code to strcmd?

Код:
CMD:vsetcolor(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command!");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle to change its color!");

    new
        vColors[2],
        iMsg[65],
		ivID = GetPlayerVehicleID(playerid);

	if(sscanf(params, "ii", vColors[0], vColors[1])) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/vSetColor < Color1 > < Color2 >");

	if(OwnedVeh(ivID) != 0)
	{
		ChangeVehicleColor(OwnedVeh(ivID), vColors[0], vColors[1]);

		vehicleinfo[OwnedVeh(ivID)][vColor1] = vColors[0];
		vehicleinfo[OwnedVeh(ivID)][vColor2] = vColors[1];

		format(iMsg, sizeof(iMsg), ""#CDGREEN"You've set this vehicle's color to: "#CBLUE"%i - %i", vColors[0], vColors[1]);
		SendClientMessage(playerid, -1, iMsg);

		SavePrivVeh(OwnedVeh(ivID));
		return 1;
	}
	else return SendClientMessage(playerid, COLOR_RED, "This is not a buyable vehicle!");
}
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/vsetcolor", true, 10) == 0)
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command!");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle to change its color!");

    new
        vColors[2],
        iMsg[65],
        ivID = GetPlayerVehicleID(playerid);

    if(sscanf(params, "ii", vColors[0], vColors[1])) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/vSetColor < Color1 > < Color2 >");

    if(OwnedVeh(ivID) != 0)
    {
        ChangeVehicleColor(OwnedVeh(ivID), vColors[0], vColors[1]);

        vehicleinfo[OwnedVeh(ivID)][vColor1] = vColors[0];
        vehicleinfo[OwnedVeh(ivID)][vColor2] = vColors[1];

        format(iMsg, sizeof(iMsg), ""#CDGREEN"You've set this vehicle's color to: "#CBLUE"%i - %i", vColors[0], vColors[1]);
        SendClientMessage(playerid, -1, iMsg);

        SavePrivVeh(OwnedVeh(ivID));
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "This is not a buyable vehicle!");
}
Reply
#3

Код:
Ownership.pwn(349) : error 017: undefined symbol "params"
line 349:
Код:
   if(sscanf(params, "ii", vColors[0], vColors[1])) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/vSetColor < Color1 > < Color2 >");
Reply
#4

Sorry for real, but i have to say that:

Why turning a horse into a donkey? :P

It's a portuguese expression to say: Why turning something good in soemthing worse? xD
Reply
#5

because my whole script is in strcmp
Reply
#6

use
Код:
#define sscanf2
at the top of ur script
Reply
#7

Quote:
Originally Posted by lewismichaelbbc
Посмотреть сообщение
because my whole script is in strcmp
So? You can use zcmd and strcmp together.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)