SA-MP Forums Archive
Convert ZCMD to strcmd - 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: Convert ZCMD to strcmd (/showthread.php?tid=348717)



Convert ZCMD to strcmp - lewismichaelbbc - 06.06.2012

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!");
}



Re: Convert ZCMD to strcmd - sniperwars - 06.06.2012

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!");
}



Re: Convert ZCMD to strcmd - lewismichaelbbc - 06.06.2012

Код:
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 >");



Re: Convert ZCMD to strcmd - ricardo178 - 06.06.2012

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


Re: Convert ZCMD to strcmd - lewismichaelbbc - 06.06.2012

because my whole script is in strcmp


Re: Convert ZCMD to strcmd - San1 - 06.06.2012

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


Re: Convert ZCMD to strcmd - MadeMan - 06.06.2012

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