Command Help
#1

Hi, I am quite new to scripting and need help turning these commands in to zcmd from strcmp and turn it from strtok to sscanf please help....

Код:
    if(strcmp(cmd,"/eject",true)==0)
	{
	    if(PlayerInfo[playerid][pAdmin] < 1) return DenyMessage(playerid, 1);
	    tmp = strtok(cmdtext, idx);
	    new otherplayer = ReturnUser(tmp);
	    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /eject [playerid]");
	    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid,COLOR_WHITE, "Invalid Player ID.");
	    RemovePlayerFromVehicle(otherplayer);
	    SendClientMessage(otherplayer, COLOR_WHITE, "You have been ejected by an Admin");
	    return 1;
	}
------------------------------
	if(strcmp(cmd,"/gethere",true) == 0)
	{
		new id;
		tmp = strtok(cmdtext, idx);
		if(PlayerInfo[playerid][pAdmin] < 2) return DenyMessage(playerid, 2);
		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /gethere [id]");
		id = ReturnUser(tmp);
		if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
		if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return                   SendClientMessage(playerid,COLOR_BRIGHTRED," You can't teleport a higher level Admin !");
		GetPlayerName(id, giveplayer, sizeof(id));
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(playerid, X, Y, Z);
		SetPlayerPos(id, X, Y+1, Z);
		GetPlayerName(id, giveplayer, sizeof(giveplayer));
		format(string, sizeof(string), "You have teleported \"%s\" to your location.", giveplayer);
  		SendClientMessage(playerid,COLOR_WHITE, string);
		SendClientMessage(id, COLOR_WHITE, "You have been Teleported");
		return 1;
	}
------------------------------
    if(strcmp(cmd, "/giveallgun", true) == 0)
	{
	    if(PlayerInfo[playerid][pAdmin] < 6) return DenyMessage(playerid, 6);
 		new tmp2[256];
	    tmp = strtok(cmdtext, idx);
     	new gun = strval(tmp);
      	tmp2 = strtok(cmdtext, idx);
      	new ammo = strval(tmp2);
      	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /giveallgun [weaponid] [ammo]");
		if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /giveallgun [weaponid] [ammo]");
  		for(new i = 0; i <= MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			    GivePlayerWeapon(i, gun, ammo);
		}
		return 1;
	}
---------------------
  if(strcmp(cmd, "/settime", true)==0)
 	{
  		if(PlayerInfo[playerid][pAdmin] < 8) return DenyMessage(playerid, 8);
        tmp = strtok(cmdtext, idx);
        new time;
		time = strval(tmp);
       	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /settime [0-24]");
		format(string, sizeof(string), "An Admin has set the time to %d.", time);
		SendClientMessageToAll(COLOR_YELLOW, string);
		SetWorldTime(time);
		return 1;
	}
ThankYou Please help....
Reply
#2

Sorry for double post but someone please help
Reply
#3

Did you search?
https://sampforum.blast.hk/showthread.php?tid=231496
https://sampforum.blast.hk/showthread.php?tid=280387
About sscanf, just read the plugin topic.
Reply
#4

ok but then what do i doo with the tmp = strtok(cmdtext, idx);.....
Reply
#5

Quote:
Originally Posted by NTS
Посмотреть сообщение
ok but then what do i doo with the tmp = strtok(cmdtext, idx);.....
Make it in SScanf!
Reply
#6

how....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)