Unknown Command and Timer
#1

I got a problem with my /premium chat, command works but after somebody send a message appear this:
Server: Unkown Command (In my PC works perfect but on Host show that thing).
Код:
if(strcmp(cmd, "/pc", true) == 0 || strcmp(cmd, "/premiumchat", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
		if(!PlayerData[playerid][pDonateRank] && !PlayerData[playerid][pAdmin]) return SendClientMessage(playerid,-1,"Nu poti folosi acest chat.");
		new stringp[128];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result))
		{
			SendUsage(playerid, "/pc [Mesaj]");
			return 1;
		}
		new iName[24];
		GetPlayerName(playerid,iName,sizeof(iName));
		if(PlayerData[playerid][pAdmin] > 0)
		{
			format(stringp, sizeof(stringp), "{FF6666}Admin %s:{FFFFFF} %s", iName, result);
		}
		else if(PlayerData[playerid][pDonateRank] > 0)
		{
			format(stringp, sizeof(stringp), "{009999}Donator %s:{FFFFFF} %s", iName, result);
		}
		for(new i = 0; i <= GetMaxPlayers(); i++)
		{
			if(PlayerData[i][pAdmin] > 0) SendClientMessage(i,-1,stringp);
			else if(PlayerData[i][pDonateRank] > 0) SendClientMessage(i,-1,stringp);
		}
		return 1;
	}
	return 1;
}
Second ask is, how to make a command to work after 10 seconds I used, for example:
I want my command /rac (respawn all cars) when I used to send a message to all players like:
Server: Masinile se vor respawna in 10 secunde.
And after 10 seconds cars will respawn...
Код:
	if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerData[playerid][pAdmin] < 3)
			{
			    SendError(playerid,cmd);
			    return 1;
			}
			new bool:unwanted[MAX_VEHICLES];
			for(new player=0; player<MAX_PLAYERS; player++)
     		{
     		    if(IsPlayerConnected(player))
				{
            		if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }

				}
     		}
			
     		format(string, sizeof(string), "Toate masinile au fost respawnate de admin %s.", PlayerData[playerid][pNume]);
			ABroadCast(COLOR_LIGHTRED,string,1);
			for(new car = 1; car < MAX_VEHICLES; car++)
			{
			    if(car != INVALID_VEHICLE_ID)
			    {
					if(!unwanted[car])
					{
					          for(new c=0;c<CAR_AMOUNT;c++)
				{
					Gas[c] = GasMax;
				}
						SetVehicleToRespawn(car);
		   				SetVehicleParamsEx(car,0,0,alarm,VehLocked[car],0,0,objective);
										if(HireCar[playerid] != 299)
					{
						HireCar[playerid] = 299;
					}
					}
				}
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)