Zcmd to Strcmp
#1

Quote:

CMDiren(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 || groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 || groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 4) {
new string[128], type;
new VID = GetPlayerVehicleID(playerid);
if(sscanf(params, "d", type))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [type]");
SendClientMessage(playerid, COLOR_GREY, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
return 1;
}
Siren[VID] = 1;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the dashboard.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
case 2:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
return 1;
}
Siren[VID] = 1;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the roof.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
case 3:
{
if(Siren[VID] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a siren on it!");
return 1;
}
Siren[VID] = 0;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
DestroyObject(SirenObject[VID]);
format(string, sizeof(string), "* %s takes down the siren.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
SendClientMessage(playerid, COLOR_GREY, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
}
}
}
else SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;

I need that is strcmp format

like this

Quote:

if(strcmp(cmd, "/cuff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "» Scrie: /cuff [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu poti utiliza aceasta comanda pe un Cop.");
return 1;
}
if(PlayerCuffed[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator are deja Cuff.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
new car = GetPlayerVehicleID(playerid);
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu poti utiliza aceasta comanda pe tine."); return 1; }
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(giveplayerid, car))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "» Ai primit Cuff de la %s.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "» I-ai dat Cuff lui %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "» %s i-a dat Cuff lui %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 0);
PlayerCuffed[giveplayerid] = 2;
PlayerCuffedTime[giveplayerid] = 180;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator nu este in Vehiculul tau.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar jucatorul nu este langa tine.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator nu este Online.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu faci parte din factiunea {3c54fc}PD{ffffff}, {3c54fc}NG {ffffff}sau {3c54fc}FBI{ffffff}.");
}
}
return 1;
}

Thanks in advance !
Reply
#2

Why you want to go from faster to slower one?
Reply
#3

All my gamemode is in strcmp
Reply
#4

Then maybe instead of going from ZCMD to strcmp, you can move from ZCMD to dcmd.

It would be faster to convert them to dcmd (using ctrl + h)
Reply
#5

Well if you are lazy.
Convert them using's Strcmp to ZCMD converter [FS]
but i recommend you to use ZCMD or YCMD than dcmd.
dcmd is slow too.
Reply
#6

Ok Ok

Can someone convert that ?
Reply
#7

Send me in PM or post here your commands you want converted, and post what processor - ycmd or anything else, preferably ycmd as it is the fastest next to zcmd. Also use [pawn] tags.
Reply
#8

Cxnnor he already tell us all.
He all wants is to convert the zcmd to strcmp.
Please read the thread next time before scrolling it down.
Reply
#9

He clearly stated
Quote:

Ok Ok

Can someone convert that ?

After he was told about DCMD and YCMD being faster.
Reply
#10

pawn Код:
CMD: Siren(playerid, params[]) {
if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 || groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 2 || groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 4) {
new string[128], type;
new VID = GetPlayerVehicleID(playerid);
if(sscanf(params, "d", type))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [type]");
SendClientMessage(playerid, COLOR_GREY, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
return 1;
}
Siren[VID] = 1;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the dashboard.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
case 2:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
return 1;
}
Siren[VID] = 1;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the roof.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
case 3:
{
if(Siren[VID] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a siren on it!");
return 1;
}
Siren[VID] = 0;
GetRPName(playerid, szPlayerName, MAX_PLAYER_NAME);
DestroyObject(SirenObject[VID]);
format(string, sizeof(string), "* %s takes down the siren.", szPlayerName);
nearByMessage(playerid, COLOR_PURPLE, string);
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
SendClientMessage(playerid, COLOR_GREY, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
}
}
}
else SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;
ZCMD TO STRCMP

An example

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "» Scrie: /cuff [Playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu poti utiliza aceasta comanda pe un Cop.");
return 1;
}
if(PlayerCuffed[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator are deja Cuff.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
new car = GetPlayerVehicleID(playerid);
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu poti utiliza aceasta comanda pe tine."); return 1; }
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(giveplayerid, car))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "» Ai primit Cuff de la %s.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "» I-ai dat Cuff lui %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "» %s i-a dat Cuff lui %s.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 0);
PlayerCuffed[giveplayerid] = 2;
PlayerCuffedTime[giveplayerid] = 180;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator nu este in Vehiculul tau.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar jucatorul nu este langa tine.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar acest jucator nu este Online.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{30a030}[GameFront]: {ffffff}Ne pare rau, dar nu faci parte din factiunea {3c54fc}PD{ffffff}, {3c54fc}NG {ffffff}sau {3c54fc}FBI{ffffff}.");
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)