[Question] - Is it possible ?
#1

Hello everybody. I have a question about strcmp. Is it possible to use strcmp in strcmp ? Example is down there.

Код:
	else if(strcmp(odabir, "buy", true) == 0)
	{
	    new slot[3], ime[15];
		if(sscanf(params, "is", slot, ime)) return SCM(playerid, color_red, "[GREЉKA]"col_white" - Niste unijeli sve paramtere komande. Koriљtenje komande: /car buy [Slot]");
		{
		    if(strcmp(slot, "1", true) == 0)
			{
				if(strcmp(ime, "landstalker", true) == 0)
				{
				    new car, novacstr[64];
				    if(!(GetPlayerMoney(playerid) >= 25000)) return SCM(playerid, color_red, "[GREЉKA]"col_white" - Ovo vozilo koљta $25.000. Nemate dovoljno novaca za kupovinu.");
				    for(new i = 0; i < sizeof(CarData); ++i)
			        {
        		    	if(!fexist(CarPath(i)))
            			car = i;
            			break;
       				}
       				CarData[PlayerVeh[playerid]][cModel] = 400;
       				strmid(CarData[car][cVlasnik], GetName(playerid), 0, strlen(GetName(playerid)), 24);
       				CarData[PlayerVeh[playerid]][cBoja] = 0;
       				//CarData[PlayerVeh[playerid]][cKreiranje] = CreateVehicle(527, pos[0], pos[1], pos[2], pos[3], 0, 0, 300);
       				CarData[PlayerVeh[playerid]][cKreiranje] = CreateVehicle(400, 0.000, 0.000, 0.000, 0.000, 0, 0, 300);
       				GivePlayerMoney(playerid, -25000);
       				SacuvajVozilo(PlayerVeh[playerid]);
       				PlayerVeh[playerid] = car;
       				SCM(playerid, color_skyblue, "[BUY]"col_white" - Kupili ste Landstalkera. Ћelimo vam sreću.");
       				format(novacstr, sizeof(novacstr), "Igrac %s je kupio Landstalkera za 25.000$.", GetName(playerid));
       				Logovi("Novac", novacstr);
				}
			}
		}
	}
Reply
#2

Yes it is, because strcmp is just a function comparing two strings. One note though, when using "i" in sscanf, you have to pass a integer, not a string, so:
pawn Код:
new slot, ime[15];
//(...)
if(slot == 1)
Consider switching strcmp based commands to ZCMD or y_commands
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Yes it is, because strcmp is just a function comparing two strings. One note though, when using "i" in sscanf, you have to pass a integer, not a string, so:
pawn Код:
new slot, ime[15];
//(...)
if(slot == 1)
Consider switching strcmp based commands to ZCMD or y_commands
Thanks, I totaly forgot that. Now, I have a bug with it. When I type ex. /car buy 1 Infernus, nothing happens.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)