message get spammed
#1

then i uses this command the message spamms that i unlocked it why?


Код:
dcmd_vunlock(playerid, params[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
	new file[256];
	format(file,sizeof(file),"cars/%d.cfg",GetPlayerVehicleID(playerid));
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Yellow, "FAIL: You're not in a vehicle.");
	else if(udb_hash(dini_Get(file,"OWNER")) != udb_hash(PlayerName(playerid))) return SendClientMessage(playerid, Yellow, "FAIL: You're not the owner of the vehicle.");
	else
	{
	new text[256];
	SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
  SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,0);
  	format(text,sizeof(text),"*%s picks up his keys and unlocks the vehicle",PlayerName(playerid));
	SendClientMessage(playerid, Purple, text);
	dini_IntSet(file,"LOCK",0);
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
	if(IsPlayerInRange(i,10.0,10.0,X,Y,Z))
	{
	if(playerid != i)
	{
	SendClientMessage(i, Purple, text);
	}
	}
	}
	}
	return 1;
}
Reply
#2

pawn Код:
dcmd_vunlock(playerid, params[])
{
    new file[128];
    format(file,sizeof(file),"cars/%d.cfg",GetPlayerVehicleID(playerid));
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Yellow, "FAIL: You're not in a vehicle.");
    else if(udb_hash(dini_Get(file,"OWNER")) != udb_hash(PlayerName(playerid))) return SendClientMessage(playerid, Yellow, "FAIL: You're not the owner of the vehicle.");
    else
    {
        new text[128];
        format(text,sizeof(text),"*%s picks up his keys and unlocks the vehicle",PlayerName(playerid));
        dini_IntSet(file,"LOCK",0);
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,0);
            if(IsPlayerInRange(i,10.0,10.0,X,Y,Z))
            {
                SendClientMessage(i, Purple, text);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)